Event bus implementation with Symfony's Event Dispatcher
composer require phpgears/event-symfony-event-dispatcher
Require composer autoload file
require './vendor/autoload.php';
use Gears\Event\Symfony\Dispatcher\ContainerAwareDispatcher;
use Gears\Event\Symfony\Dispatcher\EventBus;
use Gears\Event\Symfony\Dispatcher\Dispatcher;
$eventToHandlerMap = [];
$symfonyDispatcher = new Dispatcher($eventToHandlerMap);
// OR
/** @var \Psr\Container\ContainerInterface $container */
$symfonyDispatcher = new ContainerAwareDispatcher($container, $eventToHandlerMap);
$eventBus = new EventBus($symfonyDispatcher);
/** @var \Gears\Event\Event $event */
$eventBus->dispatch($event);
Found a bug or have a feature request? Please open a new issue. Have a look at existing issues before.
See file CONTRIBUTING.md
See file LICENSE included with the source code for a copy of the license terms.