| Package Data | |
|---|---|
| Maintainer Username: | piyushpatil027 | 
| Maintainer Contact: | piyushpatil027@gmail.com (Piyush Patil) | 
| Package Create Date: | 2015-04-10 | 
| Package Last Update: | 2015-04-13 | 
| Language: | PHP | 
| License: | MIT | 
| Last Refreshed: | 2025-10-31 03:06:00 | 
| Package Statistics | |
|---|---|
| Total Downloads: | 88 | 
| Monthly Downloads: | 0 | 
| Daily Downloads: | 0 | 
| Total Stars: | 2 | 
| Total Watchers: | 1 | 
| Total Forks: | 0 | 
| Total Open Issues: | 0 | 
Package to enable sending push notifications to android devices.
Update your composer.json file to include this package as a dependency
"piyushpatil/androidpushnotification": "dev-master"
Register the PushNotification service provider by adding it to the providers array in the config/app.php file.
'providers' => [
     'Piyushpatil\Androidpushnotification\AndroidpushnotificationServiceProvider',
]
Alias the PushNotification facade by adding it to the aliases array in the config/app.php file.
'aliases' => [
    'PushNotification' => 'Piyushpatil\Androidpushnotification\Facades\PushNotification',
]
Copy the config file into your project by running
 php artisan vendor:publish --provider="piyushpatil/androidpushnotification" --tag="config"
This will generate a config file like this
    return [
    'Android' => [
        'environment' => 'production',
        'apiKey' => 'yourAPIKey',
        'service' => 'gcm'
    ]
];
Where all first level keys corresponds to an service configuration, each service has its own properties, android for instance have apiKey. You can set as many services configurations as you want, one for each app.
service key to identify Android 'service'=>'gcm'Where app argument Android refers to defined service in config file.
To multiple devices and optioned message:
In Controller file write this line.
use PushNotification; 
PushNotification::app('Android')
                ->to($deviceToken)
                ->send('Hello World, i`m a push message');
$devices = PushNotification::DeviceCollection(array(
    PushNotification::Device('token', array('badge' => 5)),
    PushNotification::Device('token1', array('badge' => 1)),
    PushNotification::Device('token2')
));
collection = PushNotification::app('Android')
    ->to($devices)
    ->send($message);
// get response for each device push
foreach ($collection->pushManager as $push) {
    $response = $push->getAdapter()->getResponse();
}
[Notification Package]:https://github.com/Ph3nol/NotificationPusher
[Laravel Queues]:http://laravel.com/docs/queues