Skip to content

dizda/OnesignalApiBundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.