PHP Classes

PHP Google Cloud Messaging Server: Send messages to Android applications using GCM

Recommend this page to a friend!
  Info   View files View files (24)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 1,344 All time: 2,881 This week: 196Up
Version License PHP version Categories
gcm 1.0.0Freely Distributable5.3PHP 5, Wireless and Mobile, Web services
Description 

Author

This package can send messages to Android applications using Google Cloud Messaging.

It is a a PHP port of the Google Cloud Messaging Application Server originally developed in Java.

It can send HTTP requests to the Google Cloud Messaging Web services API server to send messages to Android devices with given identifiers.

The messages can be in plain text or JSON format.

The delivery of the messages can be tried again if the devices are not available or it failed from some other reason.

Innovation Award
PHP Programming Innovation award nominee
March 2013
Number 2


Prize: One downloadable e-book of choice by O'Reilly
Push notifications are messages to be delivered to users of mobile devices to tell them about important information or events related to the applications they use.

Applications based on Web services are not able to send notifications directly to the mobile devices because the devices may not be reachable when the new information or events happen.

For Android devices Google offers the Google Cloud Messaging Server that is capable of receiving the notifications to be deliver to Android application users and push them when the devices get connected.

This class can send push notifications to Android applications using the Google Cloud Messaging Server.

Manuel Lemos
Picture of Christiaan Baartse
Name: Christiaan Baartse <contact>
Classes: 4 packages by
Country: The Netherlands The Netherlands
Age: 37
All time rank: 138638 in The Netherlands The Netherlands
Week rank: 312 Up10 in The Netherlands The Netherlands Up
Innovation award
Innovation award
Nominee: 3x

Details

GCMApplicationServer ==================== [![Build Status](https://travis-ci.org/Web-Power/GCMApplicationServer.png?branch=master)](https://travis-ci.org/Web-Power/GCMApplicationServer) This is a port to PHP of the official [com.google.android.gcm.server JAVA package](http://developer.android.com/reference/com/google/android/gcm/server/package-summary.html). Usage ----- ````php $sender = new \WebPower\gcm\server\Sender('your google cloud messaging api key'); $message = \WebPower\gcm\server\Message::builder() ->addData('message', 'Hoi') ->build(); // 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](https://code.google.com/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. Installation ------------ ```` composer.phar require webpower/gcm-application-server ````

  Files folder image Files  
File Role Description
Files folder imagesrc (1 directory)
Files folder imagetest (1 directory)
Accessible without login Plain text file .gitignore Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file testPush.php Example Example script

  Files folder image Files  /  src  
File Role Description
Files folder imageWebPower (1 directory)

  Files folder image Files  /  src  /  WebPower  
File Role Description
Files folder imagegcm (1 directory)

  Files folder image Files  /  src  /  WebPower  /  gcm  
File Role Description
Files folder imageserver (13 files)

  Files folder image Files  /  src  /  WebPower  /  gcm  /  server  
File Role Description
  Plain text file BuzzHttpClient.php Class Class source
  Plain text file Constants.php Class Class source
  Plain text file HttpClient.php Class Class source
  Plain text file HttpClientResponse.php Class Class source
  Plain text file InvalidRequestException.php Class Class source
  Plain text file JsonParserException.php Class Class source
  Plain text file Message.php Class Class source
  Plain text file MessageBuilder.php Class Class source
  Plain text file MulticastResult.php Class Class source
  Plain text file MulticastResultBuilder.php Class Class source
  Plain text file Result.php Class Class source
  Plain text file ResultBuilder.php Class Class source
  Plain text file Sender.php Class Class source

  Files folder image Files  /  test  
File Role Description
Files folder imageWebPower (1 directory)

  Files folder image Files  /  test  /  WebPower  
File Role Description
Files folder imagegcm (1 directory)

  Files folder image Files  /  test  /  WebPower  /  gcm  
File Role Description
Files folder imageserver (5 files)

  Files folder image Files  /  test  /  WebPower  /  gcm  /  server  
File Role Description
  Accessible without login Plain text file InvalidRequestExceptionTest.php Test Unit test script
  Accessible without login Plain text file MessageTest.php Test Unit test script
  Accessible without login Plain text file MulticastResultTest.php Test Unit test script
  Accessible without login Plain text file ResultTest.php Test Unit test script
  Accessible without login Plain text file SenderTest.php Test Unit test script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:1,344
This week:0
All time:2,881
This week:196Up