ipedis / rabbit-client
There is no license information available for the latest version (2.1.0) of this package.
Event and Order client library
2.1.0
2026-01-22 10:16 UTC
Requires
- php: >=8.4
- ext-amqp: *
- ext-json: *
- filp/whoops: ^2.18
- guzzlehttp/guzzle: ~7.0
- ipedis/http-signature: ^3.0.0
- opis/json-schema: ^2.6
- phpunit/phpunit: ^12.5
- symfony/polyfill-uuid: ^1.14
Requires (Dev)
- brainmaestro/composer-git-hooks: ^3.0
- friendsofphp/php-cs-fixer: ^3.0
- pestphp/pest: ^4.3
- rector/rector: ^2.3
- dev-master
- 2.1.0
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.2.15
- 1.2.14
- 1.2.13
- 1.2.12
- 1.2.11
- 1.2.10
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-update-ci
- dev-update_symfony-6.4
- dev-add_return_type_ruqayyahj
- dev-add_return_type_ruqayyah
This package is auto-updated.
Last update: 2026-03-27 05:13:52 UTC
README
RabbitMQ client library for PHP supporting event publishing, order request/reply, and workflow orchestration with progress tracking. Built on the AMQP extension.
Installation
composer require ipedis/rabbit-client
Requires the
ext-amqpPHP extension.
Quick Start
Publish an event
use Ipedis\Rabbit\Event\EventDispatcher; class MyDispatcher { use EventDispatcher; protected function getSignatureKey(): string { return 'your-secret'; } } $dispatcher = new MyDispatcher(/* connection config */); $payload = EventMessagePayload::build('v1.admin.publication.was-exported', [ 'publication' => ['sid' => 42], ]); $dispatcher->dispatch($payload);
Submit an order and wait for reply
use Ipedis\Rabbit\Order\Manager; class MyManager { use Manager; } $manager = new MyManager(/* connection config */); $payload = OrderMessagePayload::build('v1.admin.publication.generate', ['data' => '...']); $manager->publish($payload, function (ReplyMessagePayload $reply) { echo $reply->getBody(); // Worker result }); $manager->run(); // Blocks until reply received
Key Concepts
| Concept | Description |
|---|---|
| Event | Fire-and-forget pub/sub message via EventDispatcher / EventListener |
| Order | Request/reply pattern via Manager (publisher) / Worker (consumer) |
| Workflow | Sequential groups of orders with progress tracking and retry logic |
| Channel | Standardized naming: v<version>.<service>.<aggregate>.<action> |
| Message Payload | Typed payloads with auto-generated UUID, timestamp, and timezone |
Channel Naming
All channels follow the pattern v<version>.<service>.<aggregate>.<action>:
v1.admin.publication.generate
v1.admin.publication.was-exported
Workflow Example
use Ipedis\Rabbit\Workflow\Workflow; use Ipedis\Rabbit\Workflow\Group; $workflow = new Workflow(function (Group $group) { $group->add(new Task('step-1', $payload1)); $group->add(new Task('step-2', $payload2)); }) ->then(function (Group $group) { $group->add(new Task('step-3', $payload3)); // Runs after group 1 completes }); $progress = $workflow->getProgressBag(); $progress->getPercentage()->getCompleted(); // 0.0 - 100.0 $progress->getStatus(); // pending|running|success|failed
Dependencies
This library depends on ipedis/http-signature for signed HTTP recovery endpoints.
Compatibility
| PHP | Status |
|---|---|
| 8.2 | ✅ |
| 8.3 | ✅ |
| 8.4 | ✅ |
| 8.5 | ✅ |
Required extensions: amqp, json
Local Development
Requires Docker.
make up # Start container make install # Install dependencies make qa # Run full QA suite (rector + pint + phpstan + tests)
Available targets:
| Command | Description |
|---|---|
make up |
Start container |
make down |
Stop container |
make install |
Install Composer dependencies |
make update |
Update Composer dependencies |
make test |
Run tests |
make phpstan |
Run static analysis (level max) |
make pint |
Fix code style (PSR-12) |
make rector |
Run automated refactoring |
make qa |
Run all checks |
make shell |
Open container shell |
Disclaimer
This package is maintained by Ipedis. It is provided as-is under the terms of its license.