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

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

2amigos/command-bus
===================

Simple Command Bus

1161PHP

Since Feb 8Pushed 8y ago1 watchersCompare

[ Source](https://github.com/2amigos/command-bus)[ Packagist](https://packagist.org/packages/2amigos/command-bus)[ RSS](/packages/2amigos-command-bus/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

Bus
===

[](#bus)

NOTE: This library still under development (tests are not yet included). Use it at your own risk.

A very simple Command Bus to plug into your project. This library differs from other similar libraries like [Tactician](http://tactician.thephpleague.com/) and [SimpleBus](http://simplebus.github.io/MessageBus/doc/command_bus.html)not on its purpose but on the approach taken.

`Bus` has been inspired by both of those libraries but it moves away from the `Command` &gt; `CommandHandler` terminology due to the function of a `Command` object. The object in other libraries work as a mere `data` object, and that IMO is what a `Message` should be, I understand `Command` should `execute` or `process` a `Message`, getting the data that requires to be executed from it. So, this library has the following characteristics:

- It handles `Message` instances
- Every `Message` is processed by exactly one `Command`
- The library is extensible by `strategies`. Currently supporting `ExecuteStrategy` (simple locate and execute), and `MiddlewareStrategy` (supporting middleware pattern). New `strategies` can be easily implemented.
- The behavior of the `MiddlewareStrategy` is also extensible. New `middlewares` can be added to the `middleware   strategy`, so `messages` can be handled the way you wish. Middlewares do things before (see `LockingMiddleware`) and/or after (see `LogginMiddleware`) handling a command.

Examples
--------

[](#examples)

- TODO

Clean code
----------

[](#clean-code)

We have added some development tools for you to contribute to the library with clean code:

- PHP mess detector: Takes a given PHP source code base and look for several potential problems within that source.
- PHP code sniffer: Tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.
- PHP code fixer: Analyzes some PHP source code and tries to fix coding standards issues.

And you should use them in that order.

### Using php mess detector

[](#using-php-mess-detector)

Sample with all options available:

```
 ./vendor/bin/phpmd ./src text codesize,unusedcode,naming,design,controversial,cleancode
```

### Using code sniffer

[](#using-code-sniffer)

```
 ./vendor/bin/phpcs -s --report=source --standard=PSR2 ./src
```

### Using code fixer

[](#using-code-fixer)

We have added a PHP code fixer to standardize our code. It includes Symfony, PSR2 and some contributors rules.

```
./vendor/bin/php-cs-fixer --config-file=.php_cs fix ./src
```

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

> [![2amigOS!](https://camo.githubusercontent.com/cda3de646752adf411381e6bbb880b7e0d4a8a5a42e610d1f5bb513e59e57dff/68747470733a2f2f732e67726176617461722e636f6d2f6176617461722f35353336333339346437323934356666376564333132353536656330343165303f733d3830)](http://www.2amigos.us)*Custom Software | Web &amp; Mobile Software Development*
> [www.2amigos.us](http://www.2amigos.us)

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/566016?v=4)[Antonio Ramirez](/maintainers/tonydspaniard)[@tonydspaniard](https://github.com/tonydspaniard)

### Embed Badge

![Health badge](/badges/2amigos-command-bus/health.svg)

```
[![Health](https://phpackages.com/badges/2amigos-command-bus/health.svg)](https://phpackages.com/packages/2amigos-command-bus)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
