PHPackages                             mcustiel/104 - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mcustiel/104

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

mcustiel/104
============

A simple helper to implement CommandBus and QueryBus

v1.0(7y ago)229GPL-3.0-or-laterPHPPHP &gt;=7.2

Since Dec 18Pushed 7y ago1 watchersCompare

[ Source](https://github.com/mcustiel/104)[ Packagist](https://packagist.org/packages/mcustiel/104)[ RSS](/packages/mcustiel-104/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

104
===

[](#104)

Simple implementation of CommandBus and QueryBus that just works.

The CommandBus and QueryBus usage is very similar. The main difference is that the commands don't return a value and the queries return an optional one.

[![Build Status](https://camo.githubusercontent.com/39fd71cfd9c1a8f589b92b97ad9415be6a2c423c3ecab84558cb4ead2ff5b513/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6375737469656c2f3130342f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mcustiel/104/build-status/master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/0dcec4009a3797fbb4df7682db670c9ef8b443aecd013af9c0f37e3a30d8a3e3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6375737469656c2f3130342f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mcustiel/104/?branch=master) [![Code Coverage](https://camo.githubusercontent.com/172748a41c19205560142bba628877ac50c6bb9df521b6389bdbd3daa788b41c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6375737469656c2f3130342f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mcustiel/104/?branch=master)

[![Cutcsa 104 paso carrasco](./files/cutcsa-viejo-104.jpg)](./files/cutcsa-viejo-104.jpg)

Example
-------

[](#example)

### Usage in Symfony:

[](#usage-in-symfony)

First you need to add your command handlers and query handlers to a container implementing PSR-11. This container has to be injected into the CommandHandlerLocator and/or the QueryHandlerLocator.

Prepare the query (or the command) and dispatch it through the proper bus.

```
