moathdev / laravel-onesignal
A Onesignal package for Laravel 5.2 or higher
Installs: 3 013
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
Requires
- php: >=5.5.0
- guzzlehttp/guzzle: ~5.3|~6.0
- illuminate/support: ~5.1
This package is not auto-updated.
Last update: 2024-11-15 07:56:03 UTC
README
A Onesignal package for Laravel 5.2 or higher
##Installation
composer require moathdev/laravel-onesignal
After install this package you have to set the service provider on your config/app.php file
Moathdev\OneSignal\ServiceProvider::class,
To use the facade add this to the facades in app/config/app.php
'OneSignal' => \Moathdev\OneSignal\Facade\OneSignal::class
Then you just need to publish files ! Copy and paste it
php artisan vendor:publish --provider="Moathdev\OneSignal\ServiceProvider"
Setting up your OneSignal account on your Environment file
ONESIGNAL_APP_ID=759xxxxxxx
ONESIGNAL_API_KEY=MjYzxxxxxx
- User Auth Key -
ONESIGNAL_USER_AUTH_KEY=ZMOADxxxxxx
##Example Usage
use Moathdev\OneSignal\Exceptions\FailedToSendNotificationException;
use Moathdev\OneSignal\Facade\OneSignal;
Route::get('/', function () {
try {
$res = OneSignal::SendNotificationToAll('Hello', 'World');
} catch (FailedToSendNotificationException $e) {
dd($e);
}
dd($res);
});
Methods supported by this package and their parameters can be found in the API Reference ##Issues
If you have any questions or issues, please open an Issue .