endroid/gcm-bundle

This package is abandoned and no longer maintained. The author suggests using the endroid/gcm package instead.

Endroid Google Cloud Messaging Bundle for Symfony

1.2.7 2016-02-22 08:13 UTC

This package is not auto-updated.

Last update: 2017-01-01 00:37:48 UTC


README

THIS BUNDLE HAS MOVED TO endroid/gcm
THIS REPOSITORY IS ABANDONED AND WILL BE REMOVED ON 01-07-2017

By endroid

Latest Stable Version Build Status Total Downloads Monthly Downloads License

This bundle enables you to use the Endroid Google Cloud Messaging (endroid/Gcm) library as a decoupled service and enables configuration through the Symfony framework. Google Cloud Messaging is a service that helps developers send data from servers to their Android applications on Android devices. For more information on the services provided see the endroid/Gcm repository and Google GCM.

knpbundles.com

Requirements

Installation

Add in your composer.json

{
    "require": {
        "endroid/gcm-bundle": "dev-master"
    }
}

Install the bundle

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update endroid/gcm-bundle

Composer will install the bundle to your project's vendor/endroid directory.

Enable the bundle via the kernel

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Endroid\Bundle\GcmBundle\EndroidGcmBundle(),
    );
}

Configuration

config.yml

endroid_gcm:
    api_key: "Your API Key (use the Browser key)"

Usage

After installation and configuration, the service can be directly referenced from within your controllers.

<?php
public function gcmSendAction()
{
    $client = $this->get('endroid.gcm.client');

    $registrationIds = array(
        // Registration ID's of devices to target
    );

    $data = array(
        'title' => 'Message title',
        'message' => 'Message body',
    );

    $response = $client->send($data, $registrationIds);

    ...
}

Versioning

Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility breaking changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.

License

This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.