dizda/onesignal-api-bundle

OneSignal API Bundle for Symfony.

0.1.5 2015-07-05 12:01 UTC

This package is not auto-updated.

Last update: 2024-12-18 04:13:54 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

OnesignalApiBundle

Integrate OneSignal API in Symfony with ease.

Use the PHP library made by Norkunas.

Setup

Install with Composer

composer require dizda/onesignal-api-bundle

Add bundle to app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        ....
        new Dizda\OnesignalApiBundle\DizdaOnesignalApiBundle()
    );
}

Configuration

Add this to your config.yml:

dizda_onesignal_api:
    app_id:       %onesignal_app_id%
    app_auth_key: %onesignal_app_auth_key%

Use

Send a simple notification:

$client = $this->get('dizda_onesignal_api.service.client');

$client->notifications->add([
    'headings' => [
        'en' => 'Withdraw'
    ],
    'contents' => [
        'en' => 'Your withdraw has been sent!'
    ],
    'included_segments' => ['All'],
    'url' => 'http://google.fr'
]);

License

MIT Licensed, see LICENSE.