2017 © Pedro Peláez
 

library google-cloud-messaging-php

Push Notification to Google Cloud Messaging PHP for Android

image

kongkannika/google-cloud-messaging-php

Push Notification to Google Cloud Messaging PHP for Android

  • Wednesday, September 30, 2015
  • by kongkannika
  • Repository
  • 2 Watchers
  • 2 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Google Cloud Messaging

Push Notification to Android device by using PHP., (*1)

How to use?

  • To push a message to many devices :
<?php
    include_once 'GoogleCloudMessaging.php';
    $registerationIds = array(
        'APA91bH-lf7YXuGvkD1-iCtcgSr4vrWbqkxIz1idD_VGzcLiUSqJd...',
        'APA91bFUvwEtgOMQcqXVn06jheApvsZAQ2KSsZrPQSdRzO5eadU4E...',
        'APA91bGZT_5uyha9nRnWZnUf6OcL_c971Pd4ckAceQPfJ3b57NhhC...',
        //...
    );
    $data = array(
        'id' => 1000,
        'message' => "Hello Android! You've got a message from me ^_^",
        'url' => 'http://www.google.com',
        //...
    );
    $gcm = new GoogleCloudMessaging('GCM_API_KEY');
    $gcm->pushMessageToManyDevices($registerationIds, $data);
?>
  • To push a message to a device :
<?php
    include_once 'GoogleCloudMessaging.php';
    $registerationId = 'APA91bH-lf7YXuGvkD1-iCtcgSr4vrWbqkxIz1idD_VGzcLiUSqJd...';
    $data = array(
        'id' => 1000,
        'message' => "Hello Android! You've got a message from me ^_^",
        'url' => 'http://www.google.com',
        //...
    );
    $gcm = new GoogleCloudMessaging('GCM_API_KEY');
    $gcm->pushMessageToOneDevice($registerationId, $data);
?>

How to get API Key?

http://developer.android.com/google/gcm/gs.html, (*2)

DONE!, (*3)

The Versions

30/09 2015

dev-master

9999999-dev https://github.com/kongkannika/GoogleCloudMessaging

Push Notification to Google Cloud Messaging PHP for Android

  Sources   Download

The Requires

  • php >=5.2.0

 

php cloud google messaging notification push gcm