dev-master
9999999-dev http://spitalia.it/PushNotificationGCM is small PHP library for send push notification to Android and iOS mobile devices.
Apache-2.0 GPL-2.0+
The Requires
- php >=5.3.0
- ext-curl *
The Development Requires
gcm push notification
Wallogit.com
2017 © Pedro Peláez
PushNotificationGCM is small PHP library for send push notification to Android and iOS mobile devices.
Google GCM Push Notification is small PHP library for send push notification to Android and iOS mobile devices., (*1)
Please follow the guide Google GCM for configure the API Key., (*2)
The preferred way to install Push Notification GCM is via composer., (*3)
Add in your composer.json:, (*4)
"require": {
...
"spitalia/push-notification-gcm": "dev-master"
}
then update your dependencies with composer update., (*5)
``` php, (*6)
$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();
}
```, (*7)
Securproject.it Team, (*8)
Free for commercial and non-commercial use (Apache License or GPL)., (*9)
PushNotificationGCM is small PHP library for send push notification to Android and iOS mobile devices.
Apache-2.0 GPL-2.0+
gcm push notification