spitalia/push-notification-gcm
Composer 安装命令:
composer require spitalia/push-notification-gcm
包简介
PushNotificationGCM is small PHP library for send push notification to Android and iOS mobile devices.
关键字:
README 文档
README
Google GCM Push Notification is small PHP library for send push notification to Android and iOS mobile devices.
Install
Please follow the guide Google GCM for configure the API Key.
Composer
The preferred way to install Push Notification GCM is via composer.
Add in your composer.json:
"require": {
...
"spitalia/push-notification-gcm": "dev-master"
}
then update your dependencies with composer update.
Start usage
$pushNotificationGCM = new PushNotificationGCM($google_api_key); $devices = array($devicetoken); $message = ['data' => ['message' => 'hello', 'reason' => 'new_event']]; try { foreach($devices as $devicetoken){ $pushNotificationGCM->addDevice($devicetoken); } // set this for send silent push notification $pushNotificationGCM->silent_notification = true; // set the title of badge $pushNotificationGCM->default_title_notification = APP_TITLE; // set this for set verbose the variable $pushNotificationGCM->reponseGCM $pushNotificationGCM->debug = true; $pushNotificationGCM->addMessage($message); $pushNotificationGCM->push(); // The array $pushNotificationGCM->reponseGCM contains array('success'=>array(),'failure'=>array()); if debug is true return other keys }catch (PushNotificationGCMException $e){ echo 'Error code: '.$e->getPushNotificationCode()." - ".$e->getMessage(); } catch(Exception $e){ echo $e->getMessage(); }
Creators
Securproject.it Team
Licence
Free for commercial and non-commercial use (Apache License or GPL).
统计信息
- 总下载量: 616
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2015-06-06