This package is abandoned and no longer maintained. No replacement package was suggested.

Google Cloud Messaging Application Server port from JAVA to PHP

1.0.4 2015-07-28 08:01 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:23:50 UTC


Build Status Scrutinizer Quality Score

This is a port to PHP of the official com.google.android.gcm.server JAVA package.


$sender = new \WebPower\gcm\server\Sender('your google cloud messaging api key');
$message = \WebPower\gcm\server\Message::builder()
    ->addData('message', 'Hoi')
// Send to a single device using text/plain
$result = $sender->singleSendNoRetry($message, 'registration id');
// or to multiple devices using application/json
$result = $sender->sendNoRetry($message, array('registration id', 'another registration id'));
echo $result; // all value objects support __toString just like the Java code

The Api key can be generated at the apis console

Registration ids are obtained by the Android App when it registers itself on the GCM service. It should be forwarded to your PHP code.


composer.phar require webpower/gcm-application-server