onesignal-laravel
![Software License][ico-license]
![Coverage Status][ico-scrutinizer]
![Total Downloads][ico-downloads], (*1)
A service provider for Onesignal API in Laravel 5, (*2)
Install
Via Composer, (*3)
``` bash
$ composer require greedchikara/onesignal dev-master, (*4)
or append your composer.json with:
``` json
"require": {
"greedchikara/onesignal": "dev-master"
},
Add the following settings to the config/app.php, (*5)
Update Service Provider, (*6)
``` php
'providers' => [
...
'greedchikara\Onesignal\OnesignalServiceProvider',
], (*7)
Update **Facade**
``` php
'aliases' => [
...
'Onesignal' => 'greedchikara\Onesignal\Facades\Onesignal',
]
Configuration
``` bash
php artisan vendor:publish --provider="greedchikara\Onesignal\OneSignalServiceProvider", (*8)
It will create **onesignal.php** within the **config directory**.
``` php
<?php
return [
/*
|--------------------------------------------------------------------------
| OneSignal User Auth Key
|--------------------------------------------------------------------------
|
| This value is used for making api call to onesignal server.
| This is a compuslory value for making onesignal api calls.
| Set this in your ".env" file.
| Api's which utilizes this key
| - Server REST API - GET /apps (View Apps)
| - Server REST API - GET /apps/:id (View an app)
|
*/
'user_auth_key' => env('ONESIGNAL_USER_AUTH_KEY'),
/*
|--------------------------------------------------------------------------
| OneSignal First App
|--------------------------------------------------------------------------
|
| Default name of first app
| Do not change the key, however you can change the value.
| But if you decide to change the value do update the procedding key.
|
*/
'first_app_name' => 'one_signal_mobile_push',
// Config of the first App
'one_signal_mobile_push' => [
/*
|--------------------------------------------------------------------------
| One Signal App Id
|--------------------------------------------------------------------------
|
| This value is used for making api call to one signal server.
| This is a compuslory value for making onesignal api calls.
| Set this in your ".env" file.
|
*/
'app_id' => env('FIRST_APP_ONESIGNAL_APP_ID'),
/*
|--------------------------------------------------------------------------
| One Signal REST API Key
|--------------------------------------------------------------------------
|
| This value is used for making api call to one signal server.
| This is a compuslory value for making onesignal api calls.
| Set this in your ".env" file.
|
*/
'rest_api_key' => env('FIRST_APP_ONESIGNAL_REST_API_KEY'),
],
/*
|--------------------------------------------------------------------------
| OneSignal API Links
|--------------------------------------------------------------------------
|
| Only update if Onesignal Updates it's API URL
|
*/
'view_apps' => 'https://onesignal.com/api/v1/apps',
'view_devices' => 'https://onesignal.com/api/v1/players',
'view_notifications' => 'https://onesignal.com/api/v1/notifications',
];
Usage
``` php
use Onesignal;
Onesignal::viewApps();, (*9)
## Change log
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Testing
``` bash
$ composer test
Todo
- Better documentation - in progress as you can see :)
- Implementing the rest of the API. :)
Contributing
Please see CONTRIBUTING and CONDUCT for details., (*10)
Security
If you discover any security related issues, please email negiakash@gmail.com instead of using the issue tracker., (*11)
Credits
License
The MIT License (MIT). Please see License File for more information., (*12)