PHP Classes

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

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 1,346 All time: 2,883 This week: 524Up
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
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 (24)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:1,346
This week:0
All time:2,883
This week:524Up