PHP code example of 7amoood / laravel-appsync-broadcaster
1. Go to this page and download the library: Download 7amoood/laravel-appsync-broadcaster 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/ */
7amoood / laravel-appsync-broadcaster example snippets
class OrderUpdated implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $order;
public function __construct(Order $order)
{
$this->order = $order;
}
public function broadcastOn()
{
return new PrivateChannel('orders/' . $this->order->id);
}
}
event(new OrderUpdated($order));
public function broadcastOn()
{
return new PresenceChannel('chat/room/' . $this->roomId);
}