Skip to content
forked from albaraam/php-gcm

A PHP library for sending messages to devices registered through Google Cloud Messaging.

License

Notifications You must be signed in to change notification settings

Arteaga2k/php-gcm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

albaraam/php-gcm

A PHP library for sending messages to devices registered through Google Cloud Messaging.

Installation

The preferred way to install this extension is through composer.

add

"albaraam/php-gcm": "dev-master"

to the require section of your composer.json.

Usage

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" field 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);

About

A PHP library for sending messages to devices registered through Google Cloud Messaging.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%