infocyph / omnibus
A unified, framework-agnostic event bus and reliable message queue for PHP.
Requires
- php: ^8.4
- infocyph/uid: ^4.3
- psr/clock: ^1.0
- psr/event-dispatcher: ^1.0
Requires (Dev)
- infocyph/cachelayer: ^2.0.1
- infocyph/dblayer: ^3.0.3
- infocyph/phpforge: dev-main@dev
Suggests
- ext-memcached: Optional for Memcached-backed uniqueness and overlap leases.
- ext-msgpack: One option for a CallbackEnvelopeSerializer binary codec.
- ext-redis: Required by the native Redis/Valkey transport.
- aws/aws-sdk-php: One option for implementing the native SQS backend boundary.
- infocyph/cachelayer: Required by unique-message, overlap, rate-limit, circuit-breaker, and distributed coordination adapters.
- infocyph/dblayer: Required by database queue, workflow, and failure-store adapters.
- php-amqplib/php-amqplib: One option for implementing the native AMQP backend boundary.
This package is auto-updated.
Last update: 2026-08-01 05:54:50 UTC
README
A framework-agnostic event bus and reliable message queue for PHP.
Omnibus provides one explicit lifecycle for synchronous commands, PSR-14 events, queued listeners, delayed work, durable consumers, workflows, scheduling adapters, and broadcasts. It works as a standalone Composer library and does not require a framework or command package.
Install
composer require infocyph/omnibus
Requirements:
- PHP
^8.4 infocyph/uidpsr/clockpsr/event-dispatcher
DBLayer, CacheLayer, Redis/Valkey clients, and broker SDKs are optional and load only when their adapters are constructed.
Highlights
- Explicit, cached route, handler, listener, codec, transport, and factory maps
- Direct synchronous handlers and ordered PSR-14 events
- In-memory, DBLayer, Redis/Valkey, AMQP, and SQS transport boundaries
- Conditional reservation settlement and visibility-based crash recovery
- Bounded retries, poison-payload capture, and durable failure management
- Safe versioned JSON envelopes with allow-listed aliases and strict limits
- CacheLayer uniqueness, overlap, rate-limit, and circuit-breaker decorators
- Redis-free operation through DBLayer, including zero-service SQLite; Memcached may back lease-based uniqueness and overlap but is not a queue transport
- Persistent chains and batches with idempotent terminal transitions
- Provider-neutral scheduling, broadcasting, after-response, and telemetry
- No filesystem scanning, hidden provider initialization, or runtime discovery
Quick start
use Infocyph\Omnibus\Envelope\HandledStamp; use Infocyph\Omnibus\Handler\HandlerMap; use Infocyph\Omnibus\MessageBus; use Infocyph\Omnibus\Routing\RouteMap; use Infocyph\Omnibus\Transport\SyncTransport; use Infocyph\Omnibus\Transport\TransportRegistry; $handlers = new HandlerMap([ CreateInvoice::class => static fn (CreateInvoice $message): string => $invoiceService->create($message), ]); $bus = new MessageBus( new RouteMap(), new TransportRegistry([ 'sync' => new SyncTransport($handlers), ]), ); $result = $bus->dispatch(new CreateInvoice($accountId)); $invoiceId = $result->last(HandledStamp::class)?->result;
Route selected messages asynchronously without changing the message or business handler:
use Infocyph\Omnibus\Routing\Route; use Infocyph\Omnibus\Routing\RouteMap; $routes = new RouteMap([ CreateInvoice::class => new Route( transport: 'redis', queue: 'billing', delaySeconds: 2.0, ), ]);
Consumer::run() performs one bounded receive call. Any application loop,
scheduler, process manager, or CLI can invoke it directly.
Delivery semantics
Durable transports provide at-least-once delivery. Terminal failures are persisted before rejection, stale receipts cannot settle reclaimed work, and telemetry failures cannot change queue or handler outcomes. Handlers that produce durable side effects must remain idempotent.
Quality checks
composer ic:tests composer ic:ci composer benchmark composer soak:consumer composer soak:durable
Documentation
Read the complete Omnibus documentation, including getting started, real-world examples, queue semantics, durable backends, serialization security, workflows, and operations.
Security
Protected by PHPForge, the automated quality and security gate used across Infocyph PHP libraries.
Made with ❤️ for the PHP communityMIT Licensed
Documentation • Security • Code of Conduct • Contributing • Report Bug • Request Feature