Skip to content

phpgears/event-symfony-messenger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

06e4af0 · Sep 12, 2020

History

7 Commits
Mar 6, 2020
Oct 5, 2019
Feb 3, 2019
Feb 3, 2019
Feb 3, 2019
Feb 3, 2019
Feb 3, 2019
Mar 6, 2020
Oct 1, 2019
Sep 12, 2020
Mar 6, 2020
Feb 3, 2019
Feb 3, 2019
Feb 22, 2019
Mar 6, 2020
Feb 3, 2019
Oct 1, 2019
Feb 3, 2019

Repository files navigation

PHP version Latest Version License

Build Status Style Check Code Quality Code Coverage

Total Downloads Monthly Downloads

Event bus with Symfony's Messenger

Event bus implementation with Symfony's Messenger

Installation

Composer

composer require phpgears/event-symfony-messenger

Usage

Require composer autoload file

require './vendor/autoload.php';

Events Bus

use Gears\Event\Symfony\Messenger\EventHandlerLocator;
use Gears\Event\Symfony\Messenger\EventBus;
use Symfony\Component\Messenger\MessageBus;
use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware;

$eventToHandlerMap = [];

/*
 * IMPORTANT! Events can go through messageBus without being handled, set second argument
 *            on Symfony's EventHandlerLocator constructor ($allowNoHandlers) to true
 */
$handlerLocator = new EventHandlerLocator($eventToHandlerMap, true);
$messengerBus = new MessageBus([new HandleMessageMiddleware($handlerLocator)]);

$eventBus = new EventBus($messengerBus);

/** @var \Gears\Event\Event $event */
$eventBus->handle($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.

About

IMPLEMENTATION - Event bus with Symfony's Messenger

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages