PHP code example of bodaclick / async-event-dispatcher

1. Go to this page and download the library: Download bodaclick/async-event-dispatcher 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/ */

    

bodaclick / async-event-dispatcher example snippets



use BDK\AsyncEventDispatcher\AsyncEventDispatcher;
use BDK\AsyncEventDispatcher\AsyncDriver\RabbitMQDriver;

$driver = new RabbitMQDriver();
$ed = new AsyncEventDispatcher();

//Single event. It also registers the event
$ed->addDriver($driver, 'event.name');

//All events available
$ed->addDriver($driver);


use BDK\AsyncEventDispatcher\AsyncEventInterface;

$event = new CustomEvent(); //implements AsyncEventInterface
$ed->dispatch($event);