Download the PHP package phpdot/rabbitmq without Composer
On this page you can find all versions of the php package phpdot/rabbitmq. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package rabbitmq
phpdot/rabbitmq
RabbitMQ messaging for PHP: publish, consume, retry, dead letter.
Install
Quick Start
Architecture
Publishing
Auto-set properties:
| Property | Default |
|---|---|
message_id |
UUIDv7 |
timestamp |
time() |
app_id |
gethostname() |
content_type |
Auto-detected (JSON or text) |
delivery_mode |
2 (persistent) |
Consuming
Three return values. No ambiguity:
- SUCCESS — ack, done
- RETRY — nack to retry queue, try again later
- DEAD — ack + forward to dead letter exchange
Unhandled exceptions are caught and dead-lettered automatically. The consumer never crashes.
Retry & Dead Letter
Retry Flow
Enable in config:
Retry infrastructure (exchange, TTL queue, bindings) is created automatically on first use.
Dead Letter
When max retries exceeded or TaskStatus::DEAD returned, the message is forwarded to the dead letter exchange with:
x-failed-queue— original queue namex-failed-reason— failure descriptionx-failed-timestamp— Unix timestamp
Replay
After fixing a bug, replay dead-lettered messages back to their original queue. Same callback pattern as consuming — return an enum, the library handles the rest.
Three actions per message:
- REPLAY — ack + republish to original exchange with original message ID. Dead-letter metadata stripped, retry counter reset.
- REMOVE — ack + discard permanently. Use the callback to clean up related data before it's gone.
- SKIP — nack with requeue. Message stays in DLQ for later.
Uses basic_get (pull mode) — processes available messages and stops. No infinite loop.
Compression
Trace Propagation
Pass trace context as plain string headers. No coupling to any tracing library.
Configuration
RabbitMQConnection Resilience
Auto-reconnect with exponential backoff:
Message API
CLI Commands
When installed in a phpdot app (with phpdot/console), these commands
auto-discover and become available under your CLI entry point:
rabbitmq:status
Connection check + topology drift detection — confirms the broker is up,
credentials work, and every exchange/queue defined in config/rabbitmq.php
is actually declared.
rabbitmq:queues
Queue depths and consumer counts — basic observability without opening the
management UI. Supports --filter=substring and --watch (refresh every
second).
rabbitmq:topology:declare
Applies the exchanges/queues/bindings from config/rabbitmq.php to the
broker. Idempotent — existing matching resources are skipped. Supports
--dry-run (preview) and --force (drop+recreate mismatched queues,
DESTRUCTIVE — confirms before dropping unless --no-interaction).
rabbitmq:peek <queue> [--limit=5]
Inspects messages in a queue without consuming them. Each peeked message
is returned to the queue via basic_reject with requeue.
rabbitmq:replay <queue> [--limit=10] [--dry-run]
Wraps the Replayer class — requeues dead-letter messages back to their
original exchange. --dry-run previews what would replay without acking.
rabbitmq:dlq:analyze <queue> [--limit=500]
Samples a dead-letter queue and groups messages by death reason and original routing-key — one-screen incident triage.
Package Structure
Development
License
MIT
All versions of rabbitmq with dependencies
php-amqplib/php-amqplib Version ^3.0
phpdot/contracts Version ^1.4
psr/log Version ^3.0
symfony/console Version ^8.0