PHP code example of b3da / pusher-bundle

1. Go to this page and download the library: Download b3da/pusher-bundle 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/ */

    

b3da / pusher-bundle example snippets


new b3da\PusherBundle\b3daPusherBundle(),

$msgSound = 'default';  # optional - can be 'default', 'none', or notification sound name
$msgNotoficationId = 1;  # optional - increment for display multiple notification simultaneously
$fcm = $this->get('b3da_pusher.android.fcm');
$message = new b3da\PusherBundle\Model\Message('title', 'message body', $msgSound, $msgNotificationId);
$fcm->notify($recipient, $message->composeAndroidFcmMessage());
# result:
dump($fcm->getOutputAsObject());

$msgSound = 'default';  # optional - can be 'default', 'none', or notification sound name
$msgNotoficationId = 1;  # optional - increment for display multiple notification simultaneously
$gcm = $this->get('b3da_pusher.android.gcm');
$message = new b3da\PusherBundle\Model\Message('title', 'message body', $msgSound, $msgNotificationId);
$gcm->notify($recipient, $message->composeAndroidGcmMessage());
# result:
dump($gcm->getOutputAsObject());

$msgSound = 'default';  # optional - can be 'default', 'none', or notification sound name
$gcm = $this->get('b3da_pusher.ios.apn');
$message = new b3da\PusherBundle\Model\Message('title', 'message body', $msgSound);
$apn->notify($recipient, $message->composeIosMessage());
# result:
dump($apn->getOutputAsObject());