phpgears/event-symfony-event-dispatcher

Event bus implementation with Symfony's Event Dispatcher

0.3.1 2019-10-05 13:20 UTC

This package is auto-updated.

Last update: 2024-04-16 15:05:23 UTC


README

PHP version Latest Version License

Build Status Style Check Code Quality Code Coverage

Total Downloads Monthly Downloads

Event bus Event Dispatcher

Event bus implementation with Symfony's Event Dispatcher

Installation

Composer

composer require phpgears/event-symfony-event-dispatcher

Usage

Require composer autoload file

require './vendor/autoload.php';

Events Bus

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);

Contributing

Found a bug or have a feature request? Please open a new issue. Have a look at existing issues before.

See file CONTRIBUTING.md

License

See file LICENSE included with the source code for a copy of the license terms.