PHPackages                             oxenti/cake\_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. oxenti/cake\_gcm

ActiveCakephp-plugin

oxenti/cake\_gcm
================

CakeGCM is a plugin for CakePHP to send notification to an Android device through Google Cloud Messaging. This project is a fork from ker0x's repo.

v1.0(10y ago)056MITPHPPHP &gt;=5.3.0

Since Dec 1Pushed 10y ago3 watchersCompare

[ Source](https://github.com/adewaleandrade/CakeGCM)[ Packagist](https://packagist.org/packages/oxenti/cake_gcm)[ RSS](/packages/oxenti-cake-gcm/feed)WikiDiscussions cake3 Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

CakeGCM
=======

[](#cakegcm)

CakeGCM is a plugin for CakePHP to send downstream message to an Android or iOS device through Google Cloud Messaging

[![Scrutinizer](https://camo.githubusercontent.com/6596fa10404f7513fc9853f9a219cd93ff4add28ecc3cb15661dfcc9ee7d1580/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6b657230782f43616b6547434d2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ker0x/CakeGCM/?branch=cake3)[![Total Downloads](https://camo.githubusercontent.com/430be47cbeb2ef076f2b6c5570a83c37ae6908d6e2888c9482cee39fc58beca8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b657230782f63616b655f67636d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ker0x/cake_gcm)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ker0x/cake_gcm)

Requirements
------------

[](#requirements)

- CakePHP &gt;= 3.\*
- PHP &gt;= 5.4

Installation
------------

[](#installation)

Run : `composer require oxenti/cake_gcm:dev-cake3`Or add it in your `composer.json`:

```
"require": {
    "oxenti/cake_gcm": "dev-cake3"
},
```

### Enable plugin

[](#enable-plugin)

In `config/bootstrap.php` file add :

```
Plugin::load('CakeGcm', ['autoload' => true]);
```

or uncomment :

```
Plugin::loadAll();
```

### Usage

[](#usage)

In `src/Controller/AppController.php` file, add :

```
$this->loadComponent('CakeGcm.Gcm', [
    'api' => [
        'key' => '*****'
    ]
]);
```

in your Controller's initialize() method. Replace `*****` by your API Key.

To get an API key, follow the instructions in this link:

Then, in an action of your Controller, add the following code:

```
if ($this->Gcm->send($ids, $data, $parameters)) {
    // do some stuff
} else {
    // do other stuff
}
```

where:

- `$ids` is a string or an array of device ids. (required)
- `$payload` is an array containing the notification and/or some datas that will be passed to a device. (optional)
- `$paramaters` is an array of parameters for the notification. (optional)

You could have the response of the request by using the function `response()`:

```
$response = $this->Gcm->response();
```

Examples
--------

[](#examples)

Send an empty notification to a device:

```
$this->Gcm->send('1');
```

Send a notification to a device:

```
$this->Gcm->send('1', [
    'notification' => [
        'title' => 'Hello World',
        'body' => 'My awesome Hellow World!'
    ]
]);
```

or

```
$this->Gcm->sendNotification('1', [
    'title' => 'Hello World',
    'body' => 'My awesome Hellow World!'
]);
```

Send a notification to multiple devices:

```
$this->Gcm->send(
    ['1', '2', '3', '4'],
    [
        'notification' => [
            'title' => 'Hello World',
            'body' => 'My awesome Hellow World!'
        ]
    ]
);
```

or

```
$this->Gcm->sendNotification(
    ['1', '2', '3', '4'],
    [
        'title' => 'Hello World',
        'body' => 'My awesome Hellow World!'
    ]
);
```

Send a notification with lots of data

```
$this->Gcm->send(
    ['1', '2', '3', '4'],
    [
        'data-1' => 'Lorem ipsum',
        'data-2' => 1234,
        'data-3' => true
    ]
);
```

Send datas to a device:

```
$this->Gcm->send(
    ['1', '2', '3', '4'],
    [
        'data' => [
            'data-1' => 'Lorem ipsum',
            'data-2' => '1234',
            'data-3' => 'true'
        ]
    ]
);
```

or

```
$this->Gcm->sendData(
    ['1', '2', '3', '4'],
    [
        'data-1' => 'Lorem ipsum',
        'data-2' => 1234,
        'data-3' => true
    ]
);
```

Send a notification and some datas to a device at the same time:

```
$this->Gcm->send(
    ['1', '2', '3', '4'],
    [
        'notification' => [
            'title' => 'Hello World',
            'body' => 'My awesome Hellow World!'
        ],
        'data' => [
            'data-1' => 'Lorem ipsum',
            'data-2' => 1234,
            'data-3' => true
        ]
    ]
);
```

Send a notification with extra parameters:

```
$this->Gcm->sendNotification(
    ['1', '2', '3', '4'],
    [
        'notification' => [
            'title' => 'Hello World',
            'body' => 'My awesome Hello World!'
        ]
    ],
    [
        'delay_while_idle' => true,
        'dry_run' => false,
        'time_to_live' => 86400,
        'collapse_key' => 'Gcm',
        'restricted_package_name' => 'my_awesome_package'
    ]
);
```

License
-------

[](#license)

The MIT License (MIT)

Copyright (c) 2015 Romain Monteil

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

3811d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c0458b3f935490a30fbe0ad70692fb5bee88e0c191e1cce409a1cb7678ad4e19?d=identicon)[oxenti](/maintainers/oxenti)

---

Top Contributors

[![monteilr-Keops](https://avatars.githubusercontent.com/u/7555155?v=4)](https://github.com/monteilr-Keops "monteilr-Keops (24 commits)")[![ker0x](https://avatars.githubusercontent.com/u/5331654?v=4)](https://github.com/ker0x "ker0x (23 commits)")[![adewaleandrade](https://avatars.githubusercontent.com/u/155085?v=4)](https://github.com/adewaleandrade "adewaleandrade (2 commits)")[![leonardobazico](https://avatars.githubusercontent.com/u/5280179?v=4)](https://github.com/leonardobazico "leonardobazico (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

cloudgooglecakephpmessaging

### Embed Badge

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

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

###  Alternatives

[google/cloud

Google Cloud Client Library

1.2k16.2M54](/packages/google-cloud)[stackkit/laravel-google-cloud-tasks-queue

Google Cloud Tasks queue driver for Laravel

84570.1k](/packages/stackkit-laravel-google-cloud-tasks-queue)[redjanym/php-firebase-cloud-messaging

PHP SDK for Firebase Cloud Messaging from Google

39847.9k1](/packages/redjanym-php-firebase-cloud-messaging)[redjanym/fcm-bundle

A Symfony Bundle for projects to send notifications in mobile devices through Firebase Cloud Messaging HTTP V1 API

43453.0k](/packages/redjanym-fcm-bundle)[jordikroon/google-vision

Google Vision Api for PHP (https://cloud.google.com/vision/)

6374.9k1](/packages/jordikroon-google-vision)[crabstudio/recaptcha

Easily use Google Recaptcha in CakePHP projects

20112.2k1](/packages/crabstudio-recaptcha)

PHPackages © 2026

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