Download the PHP package oxenti/cake_gcm without Composer
On this page you can find all versions of the php package oxenti/cake_gcm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package cake_gcm
CakeGCM
CakeGCM is a plugin for CakePHP to send downstream message to an Android or iOS device through Google Cloud Messaging
Requirements
- CakePHP >= 3.*
- PHP >= 5.4
Installation
Run : composer require oxenti/cake_gcm:dev-cake3
Or add it in your composer.json
:
Enable plugin
In config/bootstrap.php
file add :
or uncomment :
Usage
In src/Controller/AppController.php
file, add :
in your Controller's initialize() method. Replace *****
by your API Key.
To get an API key, follow the instructions in this link: http://developer.android.com/google/gcm/gs.html#access-key
Then, in an action of your Controller, add the following code:
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()
:
Examples
Send an empty notification to a device:
Send a notification to a device:
or
Send a notification to multiple devices:
or
Send a notification with lots of data
Send datas to a device:
or
Send a notification and some datas to a device at the same time:
Send a notification with extra parameters:
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.