PHP code example of braiphub / messenger-laravel

1. Go to this page and download the library: Download braiphub/messenger-laravel 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/ */

    

braiphub / messenger-laravel example snippets


use Braip\Messenger\Contracts\ShouldMessage;

class EventoTesteEnviado implements ShouldMessage
{
    public function messageWith(): array
    {
        return [
          // payload que vai ser enviado para os outros sistemas
        ];
    }
}

event(new EventoTesteEnviado());

//EventServiceProvider.php

protected $listen = [
    'Messenger:{nomeDoEvento}' => [
        // Listeners
    ]
];

class ListenerExemplo
{
    public function handle($event)
    {
        $event->payload;
        $event->eventType;
    }
}