PHPackages                             innmind/command-bus-bundle - 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. [CLI &amp; Console](/categories/cli)
4. /
5. innmind/command-bus-bundle

AbandonedArchivedLibrary[CLI &amp; Console](/categories/cli)

innmind/command-bus-bundle
==========================

Command Bus Bundle

2.0.0(9y ago)0137MITPHPPHP ~7.1

Since Jul 24Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Innmind/CommandBusBundle)[ Packagist](https://packagist.org/packages/innmind/command-bus-bundle)[ Docs](http://github.com/Innmind/CommandBusBundle)[ RSS](/packages/innmind-command-bus-bundle/feed)WikiDiscussions develop Synced yesterday

READMEChangelogDependencies (6)Versions (6)Used By (0)

CommandBusBundle
================

[](#commandbusbundle)

`master``develop`[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d0f1187910de2d9604a445eeb25c51e1016ee731349cff8d4b368c06afba815d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f496e6e6d696e642f436f6d6d616e6442757342756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Innmind/CommandBusBundle/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/97d1dea90e03cea412c5ca9b307b72817e75688a03a424e0b43dd693c31c9dee/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f496e6e6d696e642f436f6d6d616e6442757342756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/Innmind/CommandBusBundle/?branch=develop)[![Code Coverage](https://camo.githubusercontent.com/e8b3245f1e3501aa84411ee9f5cde33eaf7a166b71b5980b185be31ccb72571b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f496e6e6d696e642f436f6d6d616e6442757342756e646c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Innmind/CommandBusBundle/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/28ee76cda3ecb8f32b71d865038a21690181b80a3189c55119fa35572c430b59/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f496e6e6d696e642f436f6d6d616e6442757342756e646c652f6261646765732f636f7665726167652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/Innmind/CommandBusBundle/?branch=develop)[![Build Status](https://camo.githubusercontent.com/20661e0a5feffc49a28292221e02b059628afc7a54f94d258afbbd9d2ed00eaf/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f496e6e6d696e642f436f6d6d616e6442757342756e646c652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Innmind/CommandBusBundle/build-status/master)[![Build Status](https://camo.githubusercontent.com/672915f1c742634f22f8713dfb75f442b69e16363366e6fd307915b333b7c280/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f496e6e6d696e642f436f6d6d616e6442757342756e646c652f6261646765732f6275696c642e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/Innmind/CommandBusBundle/build-status/develop)Symfony integration of `innmind/command-bus` that ease stacking command buses.

Installation
------------

[](#installation)

```
composer require innmind/command-bus-bundle
```

In your `AppKernel.php` add the following line:

```
//app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Innmind\CommandBusBundle\InnmindCommandBusBundle,
        );
        // ...
    }
    // ...
}
```

Usage
-----

[](#usage)

```
$container->get('innmind_command_bus');
```

In order to handle your commands you need to define the handlers as services with the tag `innmind_command_bus.handler` with the attribte `handles` that will contain the command FQCN.

Advanced configuration
----------------------

[](#advanced-configuration)

You may want to add extra capabilities to the command bus to do some specific stuff before or after each command is executed (like flushing the doctrine manager or logging each command). To do so you need to create a class that implements [`CommandBusInterface`](https://github.com/Innmind/CommandBus/blob/master/src/CommandBusInterface.php). The class must at least have one argument in its contructor type hinted with this interface.

Then you declare this command bus as a service with a tag `innmind_command_bus` and an attribute `alias`. Then the alias must be placed in the `innminc_command_bus.stack` configuration array.

Example:

```
use Innmind\CommandBus\CommandBusInterface;
use Psr\Log\LoggerInterface;

final class LoggingCommandBus implements CommandBusInterface
{
    private $bus;
    private $logger;

    public function __construct(LoggerInterface $logger, CommandBusInterface $bus)
    {
        $this->logger = $logger;
        $this->bus = $bus;
    }

    public function handle($command)
    {
        $this->bus->handle($command);
        $this->logger->debug(
            'A command has been executed',
            ['class' => get_class($command)]
        );
    }
}
```

```
#app/config/services.yml
services:
    logging_command_bus:
        class: LoggingCommandBus
        arguments:
            - '@logger'
            - ~ #this is important to declare this argument as null
        tags:
            - { name: innmind_command_bus, alias: logging }
```

```
#app/config/config.yml
innmind_command_bus:
    stack:
        - queue
        - logging
        - default
```

With all this each time you handle a command it will look if there's a handle being handled (in such case it will queue it; this happens if you handle a command inside a handler), then if it can be executed it will log the command (this is your class) and finally it will call the handler associated to the command.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~70 days

Total

4

Last Release

3419d ago

Major Versions

1.1.0 → 2.0.02017-02-19

PHP version history (2 changes)1.0.0PHP ~7.0

2.0.0PHP ~7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/851425?v=4)[Baptiste Langlade](/maintainers/Baptouuuu)[@Baptouuuu](https://github.com/Baptouuuu)

---

Top Contributors

[![Baptouuuu](https://avatars.githubusercontent.com/u/851425?v=4)](https://github.com/Baptouuuu "Baptouuuu (18 commits)")

---

Tags

command busddd

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/innmind-command-bus-bundle/health.svg)

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

PHPackages © 2026

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