PHPackages                             icanboogie/message-bus - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. icanboogie/message-bus

ActiveLibrary[Queues &amp; Workers](/categories/queues)

icanboogie/message-bus
======================

A straightforward implementation of a message dispatcher

v3.0.0(3y ago)413.3k1BSD-3-ClausePHPPHP &gt;=8.0.2

Since Feb 22Pushed 3y agoCompare

[ Source](https://github.com/ICanBoogie/MessageBus)[ Packagist](https://packagist.org/packages/icanboogie/message-bus)[ Docs](https://icanboogie.org/)[ RSS](/packages/icanboogie-message-bus/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)Dependencies (8)Versions (13)Used By (1)

MessageBus
==========

[](#messagebus)

[![Packagist](https://camo.githubusercontent.com/f6d20f2bafcc9e83b00ae4c125eb30e1507885e3be6dd4cec264d42215b55982/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6963616e626f6f6769652f6d6573736167652d6275732e737667)](https://packagist.org/packages/icanboogie/message-bus)[![Code Quality](https://camo.githubusercontent.com/1b43e18cbec5b81693169662b0ce89edd381cae482f8c3b83224a174b8204265/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f4943616e426f6f6769652f4d6573736167654275732e737667)](https://scrutinizer-ci.com/g/ICanBoogie/MessageBus)[![Code Coverage](https://camo.githubusercontent.com/dc9a3251f7adca4775a97b66ff2b2e614fd163884feed307632c87135766d6b4/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f4943616e426f6f6769652f4d6573736167654275732e737667)](https://coveralls.io/r/ICanBoogie/MessageBus)[![Downloads](https://camo.githubusercontent.com/6c237da64bb6f3d452ae30eb29d366a2c2682efe8457198aea6e7e31ce183183/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6963616e626f6f6769652f6d6573736167652d6275732e737667)](https://packagist.org/packages/icanboogie/message-bus)

A message dispatcher helps to separate presentation concerns from business logic by mapping inputs of various sources to simpler application messages. It also helps to decouple the domain from the implementation, for an application only has to know about the messages, not how they are handled. A design well known in [Hexagonal architectures](https://herbertograca.com/2017/11/16/explicit-architecture-01-ddd-hexagonal-onion-clean-cqrs-how-i-put-it-all-together/).

**ICanBoogie/MessageBus** provides an implementation of a message dispatcher, with support for permissions and voters. There's also a simple implementation of a message handler provider, and one more sophisticated that works with [PSR-11](https://www.php-fig.org/psr/psr-11/) containers. Finally, there's special support for [Symfony's Dependency Injection component](https://symfony.com/doc/current/components/dependency_injection.html).

Using a message dispatcher can be as simple as the following example:

```
