2017 © Pedro Peláez
 

library push-notification-gcm

PushNotificationGCM is small PHP library for send push notification to Android and iOS mobile devices.

image

spitalia/push-notification-gcm

PushNotificationGCM is small PHP library for send push notification to Android and iOS mobile devices.

  • Thursday, July 16, 2015
  • by spitalia
  • Repository
  • 4 Watchers
  • 3 Stars
  • 185 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

Push Notification GCM

Google GCM Push Notification is small PHP library for send push notification to Android and iOS mobile devices., (*1)

Install

Please follow the guide Google GCM for configure the API Key., (*2)

Composer

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)

Start usage

``` 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)

Creators

Securproject.it Team, (*8)

Licence

Free for commercial and non-commercial use (Apache License or GPL)., (*9)

The Versions

16/07 2015

dev-master

9999999-dev http://spitalia.it/

PushNotificationGCM is small PHP library for send push notification to Android and iOS mobile devices.

  Sources   Download

Apache-2.0 GPL-2.0+

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

gcm push notification