PHP code example of albaraam / php-gcm
1. Go to this page and download the library: Download albaraam/php-gcm library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
albaraam / php-gcm example snippets
use albaraam\gcm\GCMNotification;
use albaraam\gcm\GCMMessage;
use albaraam\gcm\GCMClient;
$notification = new GCMNotification("Title","Body");
$notification
->setIcon("noti")
->setSound("water.mp3");
.....
$message = new GCMMessage($notification, "ids"); // "ids" parameter can contain a array/single registration token or a topic key
$message
->setData(['foo'=>'bar', 'baz'=>[1,2,3]])
->setCollapseKey("collapse-key-1");
.....
$gcm = new GCMClient("YOUR_API_KEY");
$response = $gcm->send($message);
var_dump($response);
json
composer
json
"albaraam/php-gcm": "~1.0.0"