PHPackages                             sakhcom/php-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. sakhcom/php-gcm

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

sakhcom/php-gcm
===============

A PHP library for sending GCM messages

1.1.4(6y ago)0212Apache-2.0PHPPHP &gt;=5.3.10

Since Jun 13Pushed 6y agoCompare

[ Source](https://github.com/SakhCom/php-gcm)[ Packagist](https://packagist.org/packages/sakhcom/php-gcm)[ Docs](https://github.com/lkorth/php-gcm)[ RSS](/packages/sakhcom-php-gcm/feed)WikiDiscussions v1.x Synced 6d ago

READMEChangelog (3)DependenciesVersions (10)Used By (0)

php-gcm
=======

[](#php-gcm)

Why
---

[](#why)

[Google Cloud Messaging for Android](http://developer.android.com/google/gcm/index.html) is great, but Google has only released a Java server side implementation. To use it with PHP we have to resort to writing custom functions or classes and dealing with HTTP, curl and headers. No More! This library is a loose port of Google's [com.google.android.gcm.server](http://developer.android.com/reference/com/google/android/gcm/server/package-summary.html)Java library and makes GCM very easy and powerful in PHP.

Install
-------

[](#install)

Composer is the easiest way to manage dependencies in your project. Create a file named composer.json with the following:

```
{
    "require": {
        "php-gcm/php-gcm": "1.1.0"
    }
}
```

And run Composer to install php-gcm:

```
$ curl -s http://getcomposer.org/installer | php
$ composer.phar install
```

Usage
-----

[](#usage)

```
$sender = new Sender($gcmApiKey);
$message = new Message($collapseKey, $payloadData);

try {
    $result = $sender->send($message, $deviceRegistrationId, $numberOfRetryAttempts);
} catch (\InvalidArgumentException $e) {
    // $deviceRegistrationId was null
} catch (PHP_GCM\InvalidRequestException $e) {
    // server returned HTTP code other than 200 or 503
} catch (\Exception $e) {
    // message could not be sent
}
```

License
-------

[](#license)

php-gcm is licensed under the Apache 2.0 License

php-gcm is based heavily on Google's Java [GCM server](http://developer.android.com/reference/com/google/android/gcm/server/package-summary.html) code

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 89.7% 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.

###  Release Activity

Cadence

Every ~308 days

Recently: every ~443 days

Total

9

Last Release

2257d ago

PHP version history (2 changes)1.1.0PHP &gt;=5.3.29

1.1.1PHP &gt;=5.3.10

### Community

Maintainers

![](https://www.gravatar.com/avatar/2add7367aff9d2e5c1167c292c8a89a8a7cf502617d29d806b65d9db3872d468?d=identicon)[POPSuL](/maintainers/POPSuL)

---

Top Contributors

[![lkorth](https://avatars.githubusercontent.com/u/1163999?v=4)](https://github.com/lkorth "lkorth (35 commits)")[![Charl13](https://avatars.githubusercontent.com/u/2190306?v=4)](https://github.com/Charl13 "Charl13 (2 commits)")[![POPSuL](https://avatars.githubusercontent.com/u/683358?v=4)](https://github.com/POPSuL "POPSuL (2 commits)")

---

Tags

phplibrarygcmandroid

### Embed Badge

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

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

PHPackages © 2026

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