承接 mhamlet/phpush 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mhamlet/phpush

最新稳定版本:v1.3

Composer 安装命令:

composer require mhamlet/phpush

包简介

PHP Package to send push notifications

README 文档

README

Latest Version Build Status Quality Score Total Downloads

PHPush is a PHP package that provide a simple API to send push notifications to foreign platforms.

Currently, we support 3 platforms - Android, iOS, and Google Chrome.

Installation

Add the package in your composer.json by executing the following command:

composer require mhamlet/phpush

Example

The following examples demonstrate how to send Push notifications with text "Hello, World!" to 2 devices in different platforms.

// Include composer autoloader
require_once 'vendor/autoload.php';

use PHPush\PHPush;

// Setting environment
PHPush::Environment(PHPush::ENVIRONMENT_PRODUCTION);

// Adding Android key
PHPush::Provider(\PHPush\Provider::PROVIDER_ANDROID)->setAccessKey('test');

// Adding iOS certificate
PHPush::Provider(\PHPush\Provider::PROVIDER_IOS)->setCertificate('ck.pem');

// Creating new queue
$queue = PHPush::Queue();

// Adding some devices
$queue->add(new \PHPush\providers\android\Device('android_registration_id'));
$queue->add(new \PHPush\providers\chrome\Device('chrome_registration_id'));
$queue->add(new \PHPush\providers\ios\Device('ios_device_token'));

// Setting message
$queue->message('Hello World!');

// Send message. You can provide custom fields to this method.
// Also you can pass sound and passphrase with this custom fields
$queue->send(array(
    'custom' => 'field',
    'sound' => 'popup.aif',
    'passphase' => 'phpush',
));

// Creating another queue
$another_queue = PHPush::Queue();

// Adding only one device
$another_queue->add(new \PHPush\providers\ios\Device('another_or_the_same_ios_device_token'));

// Setting message
$another_queue->message('Hello World! I\'m second queue!');

// This will not open a connection to APNS server again.
// It will use the old connection
$another_queue->send();

统计信息

  • 总下载量: 26
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-02