Integrate OneSignal API in Symfony with ease.
Use the PHP library made by Norkunas.
Install with Composer
composer require dizda/onesignal-api-bundle
Add bundle to app/AppKernel.php
public function registerBundles()
{
$bundles = array(
....
new Dizda\OnesignalApiBundle\DizdaOnesignalApiBundle()
);
}
Add this to your config.yml
:
dizda_onesignal_api:
app_id: %onesignal_app_id%
app_auth_key: %onesignal_app_auth_key%
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'
]);
MIT Licensed, see LICENSE.