PHP code example of marko / broadcasting-pusher

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

    

marko / broadcasting-pusher example snippets


use Marko\Broadcasting\PresenceChannel;
use Marko\Broadcasting\PrivateChannel;

// BroadcasterInterface is bound to PusherBroadcaster
$broadcaster->broadcast('shows.42', 'seat.sold', ['seat' => 'A1']);
$broadcaster->broadcast(new PrivateChannel('orders.7'), 'order.shipped', ['id' => 7]); // sent as private-orders.7
$broadcaster->broadcast(new PresenceChannel('rooms.3'), 'message.posted', ['text' => 'Hi']); // sent as presence-rooms.3