Package Data | |
---|---|
Maintainer Username: | moathdev |
Maintainer Contact: | Moath@moath.co (moathdev) |
Package Create Date: | 2021-03-25 |
Package Last Update: | 2021-03-25 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 15:04:52 |
Package Statistics | |
---|---|
Total Downloads: | 3,013 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
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 .