prooph/service-bus
59.8
Adequate · 22 September 2026
2.2k
lines of production code
PHP
primary language
7
measurements over time
What this system is
This system is a PHP-based service bus library that implements command, query, and event buses for handling asynchronous and synchronous message dispatching. It provides a modular plugin architecture for routing, authorization guards, and container integration, supporting both direct and async message processing. The codebase includes comprehensive unit tests and configuration factories for standardizing message bus instantiation and behavior.
Features
Add PSR-11 container factories for guard plugins
New factory classes have been added for the FinalizeGuard and RouteGuard plugins, enabling automatic instantiation via a PSR-11 container. Each factory retrieves the AuthorizationService from the container and passes it to the respective guard, with an optional 'exposeEventMessageName' configuration flag.
src/Container/Plugin · medium confidence
Add default configuration and service factories for Prooph Service Bus
Introduces new configuration files for the Prooph Service Bus, providing default settings for command, event, and query buses, including support for route-based message handling and optional async switching. Additionally, registers service factories for route and finalize guards, and enables static factory support for custom bus instances.
config · high confidence
Add quick-start example for command bus usage
A new quick-start example has been added to demonstrate how to use the command bus. The example includes an EchoText command class and shows how to route and dispatch commands using the Prooph ServiceBus.
examples · high confidence
Added async messaging interfaces for asynchronous message handling
The \src/Async\ directory now includes two new interfaces: \AsyncMessage\, which extends the \Message\ interface to mark messages intended for asynchronous processing, and \MessageProducer\, which defines the contract for handlers that process messages asynchronously. The \MessageProducer\ interface is invokable and supports both fire-and-forget handling and future-based responses via a \React\\Promise\\Deferred\ object, enabling integration with async message buses.
src/Async · high confidence
Introduce dedicated invoke strategies for queries, commands, and events
Added three new strategy classes in the InvokeStrategy namespace: FinderInvokeStrategy for query dispatch, HandleCommandStrategy for command handling, and OnEventStrategy for event processing. Each class implements attachToMessageBus to register specific handlers with the message bus, ensuring that queries are routed to finders, commands are handled by their respective handlers, and events are dispatched to appropriate listeners. This change refactors how the service bus invokes handlers, providing a more modular and explicit approach to message routing.
src/Plugin/InvokeStrategy · high confidence
Introduce new Guard plugins for message authorization
Added three new components to the service bus plugin system: an \AuthorizationService\ interface, a \RouteGuard\ plugin that enforces authorization checks before message dispatch, and a \FinalizeGuard\ plugin that validates authorization after message processing. Both guards support an \exposeEventMessageName\ option to control whether the specific message name is included in the \UnauthorizedException\ when access is denied.
src/Plugin/Guard · high confidence
New command, query, event, and message bus implementations
The library now provides concrete implementations for dispatching commands, queries, and events. The new \CommandBus\ handles single-handler command dispatch with queueing and exception wrapping. The \QueryBus\ supports asynchronous query execution via React promises, allowing finders to resolve or reject them. The \EventBus\ enables multi-listener event dispatching with optional exception collection. All buses extend the new \MessageBus\ base class, which standardizes event parameters, priority constants, and lifecycle hooks.
src · high confidence
New container factories for message buses
Added new factory classes (AbstractBusFactory, CommandBusFactory, EventBusFactory, QueryBusFactory) that integrate with the PSR-11 container and support interop-config for configuration. The factories allow constructing message buses with configurable plugins, routers, and optional async switch support, providing a standardized way to instantiate and configure command, event, and query buses from the container.
src/Container · high confidence
New exception classes for service bus operations
The src/Exception directory now contains a new set of exception classes for the service bus, including CommandDispatchException, EventListenerException, InvalidArgumentException, MessageDispatchException, RuntimeException, and the ServiceBusException interface. These classes provide structured error handling for command dispatch failures, event listener exceptions, and general service bus errors, with specific methods to retrieve pending commands or collected listener exceptions.
src/Exception · high confidence
New plugin infrastructure for the service bus
The library introduces a new plugin architecture for the service bus, centered around a \Plugin\ interface with \attachToMessageBus\ and \detachFromMessageBus\ methods. This enables modular extensions to the message bus, including a \MessageFactoryPlugin\ to convert array payloads into message objects, a \MessageProducerPlugin\ to route messages to an async producer, and a \ServiceLocatorPlugin\ for lazy-loading handlers via a PSR-11 container. Additionally, a \ListenerExceptionCollectionMode\ plugin is added to optionally collect exceptions on the event bus.
src/Plugin · high confidence
New router plugins for message, command, and event buses
A new plugin infrastructure for routing messages is introduced, providing multiple strategies for dispatching and handling messages. This includes the \AsyncSwitchMessageRouter\ for handling asynchronous messages, \CommandRouter\ and \QueryRouter\ for single-handler routing, \EventRouter\ for mapping event names to listeners, \RegexRouter\ for pattern-based routing, and \ServiceLocatorEventRouter\/\SingleHandlerServiceLocatorRouter\ for dependency injection container-based lookups. These components implement the \MessageBusRouterPlugin\ interface, enabling flexible message bus configuration.
src/Plugin/Router · high confidence
Behavioural changes
Repository maintenance and CI/CD configuration
The repository now includes configuration files for code style checking (\.php\_cs\), test coverage reporting (\.coveralls.yml\), and continuous integration via Travis CI (\.travis.yml\). A \phpunit.xml.dist\ file has been added to define the test suite and coverage paths. Additionally, the \LICENSE.txt\ header has been updated to reflect current copyright years and the 'prooph' brand name, and \.gitignore\ has been updated to exclude generated cache and build artifacts.
(repo-wide) · high confidence
Test coverage
Added mock classes for testing the service bus; Added test coverage for FinalizeGuard and RouteGuard plugins; Added test coverage for ServiceLocatorPlugin, MessageFactoryPlugin, MessageProducerPlugin, and ListenerExceptionCollectionMode; Added tests for CommandDispatchException; Added unit tests for InvokeStrategy plugins; Added unit tests for container-based guard factories; Added unit tests for message bus components; Added unit tests for service bus factories; Added unit tests for service-bus router plugins.
Dependencies
Upgrade to PHP 7.3/8.0 and Prooph ecosystem
The package name has changed from codeliner/php-service-bus to prooph/service-bus, reflecting a broader ecosystem integration. The library now requires PHP 7.3 or 8.0 and Prooph Common v4.0.0. Development dependencies have been updated to PHPUnit 9.3, Prophecy 1.9, and PSR Container 1.0, while the autoloading has been migrated from PSR-0 to PSR-4 under the Prooph\\ServiceBus namespace.
(dependencies) · high 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 57 → 60 (+3.2)
- Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 99 → 99 (-0.1)
- Architecture 100 → 97 (-3.0)
- Maturity 36 → 36 (+0.0)
- Readiness 50 → 63 (+13.7)
- 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 (13 lines × 2) (src/CommandBus.php)
- Duplicated block (15 lines × 2) (src/CommandBus.php)
- LLM evaluation failed
- No exposed public API
- Test reliability not included
- dormant codebase — no living knowledge left to concentrate
New (7)
- Dependency hygiene PARTLY measured — Composer dependencies read, no committed lock to grade for currency
- Duplicated block (18 lines × 2) (src/CommandBus.php)
- Duplicated block (20–22 lines × 2) (src/CommandBus.php)
- Duplicated block (7 lines × 2) (src/Container/Plugin/Guard/FinalizeGuardFactory.php)
- Duplicated block (9 lines × 2) (src/Plugin/Router/RegexRouter.php)
- Inconsistent naming for the primary message sending operation. The core abstraction MessageBus and its specialized variants (CommandBus, EventBus, QueryBus) use dispatch. However, the asynchronous producer interface MessageProducer uses __invoke. While __invoke is a valid PHP callable pattern, it creates a semantic disconnect when MessageProducer is used as a plugin (e.g., MessageProducerPlugin) that effectively acts as a message bus for async operations. Users expect a consistent verb like dispatch or send across all transport/dispatch mechanisms.
- 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
prooph/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 8645e3a15d104843b5c8aeb5ce345b16be6279de — 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.