almatar/rabbitmq
almatar/rabbitmq is a lightweight Laravel/PHP package that integrates RabbitMQ for reliable message publishing and consuming. It simplifies broker configuration and supports queue-based workflows for asynchronous jobs and events.
Read this first:
almatar/rabbitmqis [DEPRECATED] and the repository is archived (4 stars, 0 dependents). The deprecation was formalised in v1.2.0 (PR "chore: deprecate package and add migration guide"), whose own description points you tovladimir-yuldashev/laravel-queue-rabbitmq. v1.2.0 ships an in-repo migration guide — read it before anything else in this assessment. Treat the rest of this page as "how the package was used day-to-day" and as a complement to that guide, not as a reason to start a new project on it.
Queue::push, queue:work), the maintained successor is the right tool. This package is lower-level: it wraps php-amqplib so you can publish and consume arbitrary AMQP messages outside Laravel's queue abstraction.composer require almatar/rabbitmq:^1.2
Pin ^1.2 rather than ^1.0 so you actually receive the deprecation notice and the bundled migration guide.MIGRATION.md / docs/ — confirm the exact path against the v1.2.0 tag). This is now the most valuable artefact in the repository; skim it before writing code, because it tells you which of your intended usages are already solved by the successor package.config/rabbitmq.php to inspect:
php artisan vendor:publish --provider="Almatar\RabbitMQ\RabbitMQServiceProvider"
Read the generated file end-to-end before writing code. It is the source of truth for connection keys (host, port, credentials, vhost) and exchange/queue names.RABBITMQ_HOST=127.0.0.1
RABBITMQ_PORT=5672
RABBITMQ_USER=guest
RABBITMQ_PASSWORD=guest
RABBITMQ_VHOST=/
bootstrap/app.php:
$app->register(Almatar\RabbitMQ\RabbitMQServiceProvider::class);
If a facade is shipped, alias it in config/app.php (Laravel) or $app->withFacades() (Lumen). Verify the exact class names against the package source — even with the new migration guide, the general docs are thin.Fire-and-forget publishing from a service class. Inject or resolve the package's connection/facade and publish after your domain logic commits. Keep publishing out of controllers — wrap it in a small MessagePublisher service so the AMQP client doesn't leak across your codebase and so you have one place to swap in the successor package later.
Publish after commit, not inside the transaction. If you publish inside a DB transaction that later rolls back, downstream consumers act on data that never existed. Use DB::afterCommit(...) (or an event listener) to defer the publish.
Long-running consumers as Artisan commands. The idiomatic pattern is a custom command (php artisan rabbitmq:consume) that boots the connection once and loops over deliveries, dispatching to handlers. Register it in Kernel::$commands (Laravel) or $app->command() (Lumen), and run it under Supervisor with numprocs > 1 for throughput. This is where the package earns its keep: you get raw AMQP semantics — manual ack/nack, prefetch/QoS, dead-lettering — that the queue driver hides from you.
Handler-per-message-type. Map routing keys to small invokable handler classes rather than a switch inside the consumer. It keeps the consumer loop stable while message types evolve, and makes handlers trivially unit-testable with a plain array payload.
Integration with Laravel events. A clean seam is: consumer command receives a delivery → dispatches a domain event or job → Laravel's own queue/event system handles the rest. This lets you keep AMQP only at the system boundary (interop with other services) and use native Laravel tooling internally.
Topology declaration in one place. Declare exchanges, queues, and bindings in a bootstrap/setup command rather than lazily in consumers. Consumers that declare topology at runtime race each other and produce confusing PRECONDITION_FAILED errors when parameters differ.
Testing. Don't hit a broker in unit tests. Bind a fake publisher into the container and assert messages were "sent"; reserve a real broker (Testcontainers/docker-compose) for a thin integration suite covering publish→consume→ack.
php-amqplib major-version bumps will eventually break it. Plan the migration to vladimir-yuldashev/laravel-queue-rabbitmq (or direct php-amqplib) as part of adoption, not as a later cleanup. If you must keep it, fork it and pin every transitive dependency.chore: commit adding the deprecation notice and migration guide. Do not expect bug fixes, PHP/Laravel support bumps, or php-amqplib compatibility work in it. Budget zero time for "upgrade testing" and all of it for reading the guide.php artisan config:cache freezes config/rabbitmq.php; env changes silently have no effect until you re-cache. This is the #1 cause of "it works locally, not in staging."php-amqplib connections are not automatically resilient. In long-running consumers, a broker restart or idle timeout leaves you with a dead socket and a process that appears healthy. Wrap the consume loop with reconnect-with-backoff, and set heartbeats/timeouts explicitly in config.nack (with requeue where appropriate) on exception. Without a dead-letter exchange configured, poison messages will loop forever — configure DLX/DLQ up front.php-amqplib connect at all with the same credentials outside Laravel? (2) does the exchange/queue exist with matching params in the management UI? (3) is config cached? (4) is the supervisor process running the current code (queue:restart-style restart after deploys)?publish, consume) in your app so the underlying library is swappable, and avoid letting the package's facade appear in domain code. Combined with the v1.2.0 migration guide, that single abstraction is what makes the eventual migration a one-file change rather than a refactor.How can I help you explore Laravel packages today?