Skip to content
CAI
Software that uses CAICheck a score

marcosalm/service-bus

56.7

Adequate · 22 September 2026

2.4k

lines of production code

PHP

primary language

6

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a PHP-based service bus library that facilitates asynchronous and synchronous message passing through command, event, and query buses. It provides a plugin architecture for routing, authorization guards, and message handling strategies, supported by container integration and comprehensive test coverage.

Features

Add default configuration and service definitions for the Prooph Service Bus

The package now provides a default configuration file (prooph\_service\_bus.config.php) that defines the structure for command, event, and query buses, including support for the new async\_switch option. Additionally, a services.php file registers factories for route and finalize guards, as well as static factory support for the buses, enabling easier integration with a dependency injection container.

config · high confidence

Add quick-start example for the service bus

A new quick-start example has been added to demonstrate how to use the Prooph Service Bus. The example defines an EchoText command and shows how to configure a command bus with a router to handle the command, resulting in the output 'It works'.

examples · high confidence

Added async message interfaces

Introduced two new interfaces in the \Prooph\\ServiceBus\\Async\ namespace: \AsyncMessage\, which serves as a marker interface for commands intended for asynchronous processing, and \MessageProducer\, which defines the contract for handlers that process messages asynchronously. The \MessageProducer\ interface is invokable, allowing message buses to treat producers as standard message handlers while supporting optional future responses via a \Deferred\ object.

src/Async · high confidence

Added factory classes for FinalizeGuard and RouteGuard

Introduced new container factories for the FinalizeGuard and RouteGuard plugins. These factory classes enable dependency injection container integration, allowing the guards to be instantiated with configurable options such as the exposeEventMessageName flag, simplifying the setup of authorization checks within the service bus plugin system.

src/Container/Plugin · high confidence

Initial project scaffolding and CI configuration

The repository is initialized with essential build and quality tools: a Travis CI configuration that runs tests across PHP 5.5, 5.6, and 7.0, along with php-cs-fixer and docheader for code style and license header enforcement. A Coveralls integration is added to report test coverage, and a PHPUnit configuration is provided to structure the test suite. The README is updated to reflect the new project structure, and the license file is updated to reflect the correct contact information.

(repo-wide) · high confidence

Introduce new invoke strategy classes for handling commands, events, and finders

Added new classes to the \Prooph\\ServiceBus\\Plugin\\InvokeStrategy\ namespace: \AbstractInvokeStrategy\ as a base implementation, \HandleCommandStrategy\ for routing commands to handlers via \handle\ or \handle{CommandName}\ methods, \OnEventStrategy\ for routing events to \on{EventName}\ methods, and \FinderInvokeStrategy\ for resolving query results via deferred values. These classes implement the \ActionEventListenerAggregate\ interface and use the \HasMessageName\ interface to determine method names dynamically.

src/Plugin/InvokeStrategy · high confidence

Introduce route and finalize guards for message authorization

The Guard plugin now enforces authorization checks at two stages of message processing. The new RouteGuard intercepts messages before they are routed, while the FinalizeGuard validates authorization after processing completes. Both guards utilize the new AuthorizationService interface, which checks permissions based on the message name and context. If access is denied, an UnauthorizedException is thrown, optionally exposing the specific message name in the error message depending on configuration.

src/Plugin/Guard · high confidence

Introduction of CommandBus, EventBus, QueryBus, and MessageBus classes

The src directory now contains the core message bus implementations: CommandBus for synchronous command dispatch, EventBus for event broadcasting, QueryBus for asynchronous query handling with promises, and the abstract MessageBus base class. These classes provide the foundational API for sending commands, events, and queries through the service bus, supporting both immediate execution and deferred promise-based workflows.

src · high confidence

New exception classes for command and message dispatch errors

The library now introduces a dedicated exception hierarchy under the Prooph\\ServiceBus\\Exception namespace. A new ServiceBusException marker interface is provided, along with a base RuntimeException. Specific exceptions include MessageDispatchException, which captures failed dispatch events and error details, and CommandDispatchException, which wraps dispatch failures and exposes pending commands for recovery or inspection. These changes allow developers to catch and handle service bus dispatch errors with greater specificity.

src/Exception · high confidence

New plugins for message factory, async production, and service location

Three new plugins have been added to the service bus plugin layer: MessageFactoryPlugin converts incoming array payloads into Message objects using a provided MessageFactory; MessageProducerPlugin routes messages to an async MessageProducer, handling both EventBus and standard MessageBus targets; and ServiceLocatorPlugin enables lazy-loading of message handlers by resolving handler aliases from an Interop ContainerInterface. These additions provide new ways to instantiate, route, and locate message handlers within the bus.

src/Plugin · high confidence

New router plugins for message bus routing

Added new router implementations to the service bus plugin system, including an \AsyncSwitchMessageRouter\ for handling asynchronous message production, alongside dedicated routers for commands (\CommandRouter\), queries (\QueryRouter\), events (\EventRouter\), and pattern-based matching (\RegexRouter\). These components introduce a \MessageBusRouterPlugin\ interface and support fluent configuration for mapping messages and events to their respective handlers.

src/Plugin/Router · high confidence

Behavioural changes

Introduce container-based bus factories with static factory support

The container integration for service buses has been refactored to support the Interop Config 1.0 standard, allowing factories to be instantiated via static methods (e.g., \CommandBusFactory::\_\_callStatic\) for easier usage. The \AbstractBusFactory\ now uses \optionsWithFallback()\ to reduce boilerplate, and the \containerId\ method is checked for backward compatibility. Additionally, the \AsyncSwitchMessageRouter\ is now supported via a new \async\_switch\ configuration option in the bus factory.

src/Container · high confidence

Test coverage

Added mock classes for testing the service bus; Added tests for CommandDispatchException; Added tests for service bus container factories; Added unit tests for ServiceBus plugins; Added unit tests for guard factory classes; Added unit tests for invoke strategy components; Added unit tests for message router plugins; Added unit tests for the Guard plugin's Finalize and Route behaviors; Added unit tests for the service bus components.

Dependencies

Rebrand to prooph/service-bus with modernized dependencies

The package has been renamed to prooph/service-bus and updated to support PHP 5.5+ and 7.0, with a shift to PSR-4 autoloading under the Prooph namespace. Key dependency changes include requiring prooph/common ^3.7 and phpunit ^4.8.23, while moving container-interop and interop-config to suggest/dev sections. The package also introduces scripts for code style checking and testing.

(dependencies) · medium confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 63 → 57 (-6.2)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 99 → 99 (-0.1)
  • Architecture 98 → 97 (-1.7)
  • Maturity 46 → 46 (+0.0)
  • Readiness 57 → 39 (-17.3)
  • Security 100 → 100 (+0.0)

Resolved (8)

  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
  • Duplicated block (14 lines × 2) (src/CommandBus.php)
  • Duplicated block (9 lines × 2) (src/CommandBus.php)
  • No exposed public API
  • Test reliability not included
  • The Quick Start example clips mid-sentence before showing how to register a command handler (the router->to(...) line), leaving the reader unsure whether the code path is complete. (README.md)
  • dormant codebase — no living knowledge left to concentrate

New (8)

  • Dependency hygiene PARTLY measured — Composer dependencies read, no committed lock to grade for currency
  • Documentation: no usage examples (README.md)
  • Duplicated block (10 lines × 2) (src/Plugin/Router/RegexRouter.php)
  • Duplicated block (10–11 lines × 2) (src/CommandBus.php)
  • Duplicated block (22–23 lines × 2) (src/CommandBus.php)
  • Duplicated block (7 lines × 2) (src/Container/Plugin/Guard/FinalizeGuardFactory.php)
  • Inconsistent naming for the primary message sending operation. The core MessageBus and its specialized variants (CommandBus, EventBus, QueryBus) all use 'dispatch'. However, the asynchronous producer interface uses '__invoke'. While '__invoke' is a common PHP pattern for callable objects, it creates a semantic disconnect when comparing the synchronous bus API (dispatch) with the asynchronous producer API (invoke).
  • No dependency advisory monitoring

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

marcosalm/service-bus was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 22 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit a39f806b67d3480ea6bb6eb3ae712f0aab4b2c05 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-821afab8930d.