jardisadapter / messaging
A powerful, unified PHP messaging library for Redis, Kafka, and RabbitMQ with automatic serialization, consumer groups, and production-ready features
Installs: 71
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/jardisadapter/messaging
Requires
- php: >=8.2
- ext-amqp: *
- ext-pcntl: *
- ext-rdkafka: *
- ext-redis: *
- jardisport/messaging: ^1.0.0
- jardissupport/dotenv: ^1.0.0
Requires (Dev)
- phpstan/phpstan: ^2.0.4
- phpunit/phpunit: ^10.5
- squizlabs/php_codesniffer: ^3.11.2
This package is auto-updated.
Last update: 2026-02-25 17:38:40 UTC
README
Part of the Jardis Ecosystem — A modular DDD framework for PHP
A powerful, unified PHP messaging library that makes working with Redis, Kafka, and RabbitMQ effortless. One API, multiple transports — switch between message brokers with zero code changes while your business logic stays clean.
Features
- One API, Multiple Transports — Switch between Redis Streams, Apache Kafka, RabbitMQ, and InMemory (for testing) with zero code changes
- Layered Architecture — Automatic fallback and broadcast across multiple brokers for high availability
- InMemory Transport — Deterministic testing without infrastructure dependencies
- Fluent API — 2-line setup, zero boilerplate
- Automatic Serialization — JSON encoding/decoding for arrays and JsonSerializable objects
- Consumer Groups — Horizontal scaling with Redis and Kafka consumer groups
- Graceful Shutdown — Clean stop on SIGTERM/SIGINT signals
- Lazy Connections — Connect only when needed, perfect for DI containers
- External Connection Support — Reuse existing connections from legacy systems
Installation
composer require jardisadapter/messaging
Quick Start
use JardisAdapter\Messaging\MessagePublisher; use JardisAdapter\Messaging\MessageConsumer; use JardisAdapter\Messaging\Handler\CallbackHandler; // Publishing $publisher = (new MessagePublisher())->setRedis('localhost'); $publisher->publish('orders', ['order_id' => 123, 'total' => 99.99]); // Consuming $consumer = (new MessageConsumer()) ->setRedis('localhost') ->enableGracefulShutdown(); $handler = new CallbackHandler(function (array|string $message, array $metadata): bool { echo "Processing order #{$message['order_id']}\n"; return true; // ACK }); $consumer->consume('orders', $handler);
Documentation
Full documentation, examples and API reference:
jardis.io/docs/adapter/messaging
Jardis Ecosystem
This package is part of the Jardis Ecosystem — a collection of modular, high-quality PHP packages designed for Domain-Driven Design.
| Category | Packages |
|---|---|
| Core | Domain, Kernel, Data, Workflow |
| Adapter | Cache, Logger, Messaging, DbConnection |
| Support | DotEnv, DbQuery, Validation, Factory, ClassVersion |
| Tools | Builder, DbSchema |
License
This package is licensed under the PolyForm Noncommercial License 1.0.0.
For commercial use, see COMMERCIAL.md.