PHPackages                             meritum/bus-module - 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. meritum/bus-module

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

meritum/bus-module
==================

Meritum module for bootstrapping georgeff/bus into the kernel ecosystem

1.0.0(yesterday)00MITPHPPHP ^8.4CI passing

Since Jun 8Pushed yesterdayCompare

[ Source](https://github.com/MeritumIO/bus-module)[ Packagist](https://packagist.org/packages/meritum/bus-module)[ RSS](/packages/meritum-bus-module/feed)WikiDiscussions main Synced yesterday

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

meritum/bus-module
==================

[](#meritumbus-module)

Meritum module for bootstrapping [`georgeff/bus`](https://github.com/MikeGeorgeff/bus) into the kernel ecosystem.

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

[](#installation)

```
composer require meritum/bus-module
```

Usage
-----

[](#usage)

Register the module with your kernel before boot:

```
use Meritum\BusModule\BusModule;

$kernel->addModule(new BusModule());
```

The module registers `HandlerLocatorInterface`, `HandlerResolverInterface`, and `DispatcherInterface`. Resolve the dispatcher from the container to dispatch commands:

```
use Georgeff\Bus\DispatcherInterface;

$dispatcher = $container->get(DispatcherInterface::class);
$dispatcher->dispatch(new PlaceOrderCommand($data));
```

Handler convention
------------------

[](#handler-convention)

`BusModule` wires `ClassNameLocator` as the handler locator. Handler classes must be named after their command with a `Handler` suffix and must be invokable:

```
final class PlaceOrderCommandHandler
{
    public function __invoke(PlaceOrderCommand $command): void
    {
        // ...
    }
}
```

Handlers are resolved from the container, so register each handler as a service:

```
$kernel->define(PlaceOrderCommandHandler::class, fn() => new PlaceOrderCommandHandler());
```

Middleware
----------

[](#middleware)

Tag services with `bus.middleware` to add them to the dispatch pipeline:

```
$kernel->define(
    LoggingMiddleware::class,
    fn(ContainerInterface $c) => new LoggingMiddleware($c->get(LoggerInterface::class)),
)->tag('bus.middleware');
```

Middleware receive the command and a `$next` callable. Call `$next($command)` to continue the pipeline:

```
final class LoggingMiddleware
{
    public function __invoke(object $command, callable $next): mixed
    {
        $this->logger->info('Dispatching', ['command' => $command::class]);
        $result = $next($command);
        $this->logger->info('Dispatched', ['command' => $command::class]);

        return $result;
    }
}
```

Middleware runs in the order services are tagged.

Options
-------

[](#options)

To bypass the middleware pipeline and use the plain dispatcher:

```
$kernel->addModule(new BusModule(useMiddlewareAwareDispatcher: false));
```

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c8147ce1d901e9fa2ec95d6408e5862025211f9ae60131e41fb115a5a0916ce4?d=identicon)[georgeff](/maintainers/georgeff)

---

Top Contributors

[![MikeGeorgeff](https://avatars.githubusercontent.com/u/6169468?v=4)](https://github.com/MikeGeorgeff "MikeGeorgeff (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/meritum-bus-module/health.svg)

```
[![Health](https://phpackages.com/badges/meritum-bus-module/health.svg)](https://phpackages.com/packages/meritum-bus-module)
```

PHPackages © 2026

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