PHP code example of andreshg112 / pusher-api-notifications

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

    

andreshg112 / pusher-api-notifications example snippets


'providers' => [
    // ...,
    Andreshg112\PusherApiNotifications\PusherApiServiceProvider::class,
],

use Andreshg112\PusherApiNotifications\PusherApiChannel;

public function via($notifiable)
{
    return [PusherApiChannel::class];
}

use Andreshg112\PusherApiNotifications\PusherApiMessage;

public function toApiNotification($notifiable)
{
    return (new PusherApiMessage)
        ->channels($channelName)
        ->event($eventName)
        ->data($data)
        ->socketId($socketId)
        ->debug($debug)
        ->alreadyEncoded($alreadyEncoded);

    // or

    return new PusherApiMessage($channelName, $eventName, $data, $socketId, $debug, $alreadyEncoded);
}