PHP code example of dsnoeck / laravel-push-notification

1. Go to this page and download the library: Download dsnoeck/laravel-push-notification library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dsnoeck / laravel-push-notification example snippets


'aliases' => array(
    'PushNotification' => 'Davibennun\LaravelPushNotification\Facades\PushNotification'
)


PushNotification::app('appNameIOS')
                ->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')
));
$message = PushNotification::Message('Message Text',array(
    'badge' => 1,
    'sound' => 'example.aiff',
    
    'actionLocKey' => 'Action button title!',
    'locKey' => 'localized key',
    'locArgs' => array(
        'localized args',
        'localized args',
        'localized args'
    ),
    'launchImage' => 'image.jpg',
    
    'custom' => array('custom data' => array(
        'we' => 'want', 'send to app'
    ))
));
PushNotification::app('appNameIOS')
                ->to($devices)
                ->send($message);


'providers' => array(
    Davibennun\LaravelPushNotification\LaravelPushNotificationServiceProvider
)

php artisan config:publish davibennun/laravel-push-notification