PHPackages                             lukyrys/gcm - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. lukyrys/gcm

AbandonedLibrary[HTTP &amp; Networking](/categories/http)

lukyrys/gcm
===========

Google Cloud Messaging PHP library. Sender for sending Messages over HTTP amd Deamon for sending and recieving messages over XMPP (CCS).

011PHP

Since Feb 23Pushed 9y ago1 watchersCompare

[ Source](https://github.com/lukyrys/Gcm)[ Packagist](https://packagist.org/packages/lukyrys/gcm)[ RSS](/packages/lukyrys-gcm/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

PHP Google Cloud Messiging
==========================

[](#php-google-cloud-messiging)

Google Cloud Messaging PHP library. Gcm\\Http\\Sender for sending Messages over HTTP and Gcm\\Xmpp\\Daemon for sending and recieving messages over XMPP (CCS).

Dependencies
------------

[](#dependencies)

- Nette/Utils ~2.2.0
- JAXL 3.0.0

Install
-------

[](#install)

Best way is [Composer](http://getcomposer.org/):

```
$ composer require petrsladek/gcm:dev-master
```

Usage
-----

[](#usage)

### Http Sender

[](#http-sender)

```
use Gcm\Message;
use Gcm\Http\Sender;

$message = new Message("DEVICE_GCM_ID", ['foo'=>'bar', 'baz'=>[1,2,3]], "collapse-key-1");
$message->addTo("ANOTHER_DEVICE_GCM_ID");
$message->timeToLive(3600); // TTL 1 hour

$gcm = new Sender("YOUR_API_KEY");
$response = $gcm->send($message);

var_dump($response);
```

### XMPP Daemon recieving message

[](#xmpp-daemon-recieving-message)

```
use Gcm\Xmpp\Daemon;

$daemon = new Daemon("SENDER_ID", "API_KEY", $testMode = false);;

$daemon->onReady[] = function(Daemon $daemon) {
    print "Ready / Auth success. Waiting for Messages";
};
$daemon->onAuthFailure[] = function(Daemon $daemon, $reason) {
    print "Auth failure (reason $reason)";
};
$daemon->onStop[] = function(Daemon $daemon) {
    print 'Daemon has stopped by $daemon->stop()';
};
$daemon->onDisconnect[] = function(Daemon $daemon) {
    print "Daemon has been disconected";
};
$daemon->onMessage[] = function(Daemon $daemon, \Gcm\RecievedMessage $message) {
    print "Recieved message from GCM";
    print_r($message);
};

$daemon->run(); // running until call $daemon->stop() or kill process;
```

### XMPP Daemon sending messages

[](#xmpp-daemon-sending-messages)

```
use Gcm\Xmpp\Daemon;
use Gcm\Message;

$daemon = new Daemon("SENDER_ID", "API_KEY", $testMode = false);

$daemon->onReady[] = function(Daemon $daemon) {
    print "Ready / Auth success. Waiting for Messages";

    // We send 5 messages to device
    foreach([1,2,3,4,5] as $i) {
      $message = new Message("DEVICE_GCM_ID", ['text'=>"$i.message from server"],  "collapse-key-$i");
      $daemon->send($message);
    }
};
$daemon->onAuthFailure[] = function(Daemon $daemon, $reason) {
    print "Auth failure (reason $reason)";
};
$daemon->onStop[] = function(Daemon $daemon) {
    print 'Daemon has stopped by $daemon->stop()';
};
$daemon->onDisconnect[] = function(Daemon $daemon) {
    print "Daemon has been disconected";
};
$daemon->onMessage[] = function(Daemon $daemon, \Gcm\RecievedMessage $message) {
    print "Recieved message from GCM";
    print_r($message);
};
$daemon->onAllSent[] = function(Daemon $daemon, $countMessages) {
    print "Has been sent all of $countMessages";
    // On all of 5 messages has been sent and confirmed from server
    $deamom->stop(); // We stopped listeng
};

$daemon->run(); // Start sending messaging
```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/01e4841749ee2b4cf7211d784b093bf67523ed6489c6931401211b130df13884?d=identicon)[lukyrys](/maintainers/lukyrys)

---

Top Contributors

[![PetrSladek](https://avatars.githubusercontent.com/u/9083002?v=4)](https://github.com/PetrSladek "PetrSladek (10 commits)")[![lukyrys](https://avatars.githubusercontent.com/u/2318346?v=4)](https://github.com/lukyrys "lukyrys (3 commits)")

### Embed Badge

![Health badge](/badges/lukyrys-gcm/health.svg)

```
[![Health](https://phpackages.com/badges/lukyrys-gcm/health.svg)](https://phpackages.com/packages/lukyrys-gcm)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M81](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.8k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M89](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
