| Package Data | |
|---|---|
| Maintainer Username: | asachanfbd |
| Maintainer Contact: | asachanfbd@gmail.com (Abhishek Sachan) |
| Package Create Date: | 2016-04-20 |
| Package Last Update: | 2016-04-20 |
| Home Page: | |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-31 03:02:44 |
| Package Statistics | |
|---|---|
| Total Downloads: | 787 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 2 |
| Total Watchers: | 2 |
| Total Forks: | 2 |
| Total Open Issues: | 0 |
Based on https://github.com/davibennun/laravel-push-notification forked from https://github.com/larkinwhitaker/laravel-push-notification
Added support for Laravel 5.2.*.
Installing the package
composer require asachanfbd/laravel-push-notification
Register the PushNotification service provider by adding it to the providers array in the config/app.php file.
'providers' => array(
'Asachanfbd\LaravelPushNotification\PushNotificationServiceProvider'
)
Alias the PushNotification facade by adding it to the aliases array in the config/app.php file.
'aliases' => array(
'PushNotification' => 'Asachanfbd\LaravelPushNotification\PushNotification',
)
Copy the config file into your project by running
php artisan vendor:publish
This will generate a config file like this
array(
'iOS' => [
'environment' => env('IOS_PUSH_ENV', 'development'),
'certificate' => env('IOS_PUSH_CERT', __DIR__ . '/ios-push-notification-certificates/development/certificate.pem'),
'passPhrase' => env('IOS_PUSH_PASSWORD', '291923Job'),
'service' => 'apns'
],
'android' => [
'environment' => env('ANDROID_PUSH_ENV', 'development'),
'apiKey' => env('ANDROID_PUSH_API_KEY', 'yourAPIKey'),
'service' => 'gcm'
]
);
Where all first level keys corresponds to an service configuration, each service has its own properties, android for instance have apiKey and IOS uses certificate and passPhrase. You can set as many services configurations as you want, one for each app. A directory with the name 'ios-push-notification-certificates' will be added to the config folder for you to store both development and production certificates.
service key to identify iOS 'service'=>'apns' and Android 'service'=>'gcm'
PushNotification::app('iOS')
->to($deviceToken)
->send('Hello World, i`m a push message');
This package should be used with Laravel Queues, so pushes dont blocks the user and are processed in the background, meaning a better flow.