PHP code example of pod-point / laravel-aws-pubsub
1. Go to this page and download the library: Download pod-point/laravel-aws-pubsub library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
useApp\Models\Order;
useIlluminate\Contracts\Broadcasting\ShouldBroadcast;
useIlluminate\Queue\SerializesModels;
classOrderShippedimplementsShouldBroadcast{
useSerializesModels;
/**
* The order that was shipped.
*
* @var \App\Models\Order
*/public $order;
/**
* Create a new event instance.
*
* @param \App\Models\Order $order
* @return void
*/publicfunction__construct(Order $order){
$this->order = $order;
}
/**
* Get the topics that model events should broadcast on.
*
* @return array
*/publicfunctionbroadcastOn(){
return ['orders']; // This is the Topic name for the ARN 'arn:aws:sns:us-east-1:123456789:orders' for example
}
}