enqueue/laravel-queue
Integrates Laravel’s queue system with Enqueue, providing a transport-agnostic queue driver for sending and consuming jobs through brokers such as AMQP, Redis, and others. Useful for apps already using Enqueue or needing flexible message transports.
1. Install the bridge and a transport. The bridge alone does nothing — you must also require the Enqueue transport for the broker you actually use. Pick the DSN scheme first, then match it:
composer require enqueue/laravel-queue
composer require enqueue/amqp-lib # amqp:// (RabbitMQ via php-amqplib)
# or: enqueue/redis, enqueue/sqs, enqueue/stomp, enqueue/kafka, enqueue/fs, enqueue/null
Check the package's composer.json for the Laravel version constraint before upgrading — releases are infrequent (last 2025-04-07), so pin your Laravel and enqueue/* versions together.
2. Publish the config. Laravel 5.5+ auto-discovers the service providers; if you're on an older setup, register Enqueue\LaravelQueue\EnqueueServiceProvider and Enqueue\LaravelQueue\EnqueueQueueServiceProvider in config/app.php.
php artisan vendor:publish --provider="Enqueue\LaravelQueue\EnqueueServiceProvider"
This writes config/enqueue.php, which holds a default transport plus a transports map keyed by DSN:
// config/enqueue.php
'default' => env('ENQUEUE_CONNECTION', 'default'),
'transports' => [
'default' => ['dsn' => env('ENQUEUE_DSN', 'file://'.storage_path('enqueue'))],
],
3. Add a queue connection. In config/queue.php:
'enqueue' => [
'driver' => 'enqueue',
'connection' => 'default', // key into config/enqueue.php transports
'queue' => 'default',
],
4. Point Laravel at it with QUEUE_CONNECTION=enqueue and ENQUEUE_DSN=amqp://guest:guest@rabbitmq:5672/%2f.
First use case — move existing jobs off Redis/DB without touching job code. Anything already implementing ShouldQueue and dispatched via dispatch() now flows through Enqueue untouched. Start with the file:// DSN locally (no broker required), watch storage/enqueue fill up, then flip ENQUEUE_DSN to your broker. Run php artisan queue:work enqueue --queue=default --sleep=1 and confirm a trivially dispatched job is consumed. Inspect the broker side (RabbitMQ management UI, redis-cli LLEN, or the SQS console) — not Laravel — when nothing shows up.
dispatch(), dispatchSync(), Bus::chain(), Bus::batch(), onQueue(), onConnection(), delay() all work because the driver implements Laravel's Queue contract. The only real change is configuration and broker operations.config/enqueue.php transports and several config/queue.php connections ('rabbit', 'sqs', 'staging') each pointing at a different connection. Route per job with ->onConnection('sqs') or globally with QUEUE_CONNECTION.->onQueue('emails') maps to an Enqueue topic/queue name. On RabbitMQ this auto-declares with default options; on SQS the queue must already exist. Keep a small provisioning step (Terraform, an artisan command, or RabbitMQ policy) so workers and producers agree on names and durability.pushRaw() to put a plain JSON payload on a queue that non-PHP services consume, and read it in Laravel via Job::getRawBody(). Conversely, if another service needs to produce work for Laravel, it must produce Laravel's serialized job payload — usually not worth it; prefer pushRaw + a thin handler that re-dispatches typed jobs.->delay($ttl) and maps to the transport's native delay where available. For anything more complex than a few minutes, schedule in a database/cron and dispatch immediately.Job instance. Test a chained batch early — this is the place where thin bridges tend to leak.queue:work enqueue --queue=high,default --tries=3 --timeout=60 under Supervisor. Size worker count to the broker's prefetch/concurrency settings, not to PHP-FPM's.QUEUE_CONNECTION=sync for unit tests that assert dispatch happened; use the file:// transport or a dedicated staging broker for integration tests. Don't point tests at a shared broker you don't control.Interop\Queue\Context (or the package's connection factory) into the container in a service provider instead of fighting the config array.composer require enqueue/laravel-queue alone — you'll get a class-not-found or "no connection factory for scheme" error. Install the matching enqueue/* transport package.Illuminate\Queue\RedisQueue internals; enqueue/redis gives you a valid Redis driver but not Horizon's UI/metrics/balancing. If you need Horizon, stay on the native Redis driver.pop() is pull-based. If the transport returns null immediately, queue:work without --sleep becomes a hot loop hammering the broker. Always pass --sleep=1 (or more) and set block_for-style options in the transport config where supported.->delay() and assume it works everywhere — verify per transport before shipping.$job->release() maps to a reject/requeue on the broker, and Laravel's --tries counter lives in the payload while the broker tracks its own delivery count. These two counters can disagree, producing infinite redelivery or premature dead-lettering. Tune visibility timeout / prefetch together with --timeout and --tries.$job->fail() actually writes to failed_jobs and that queue:failed, queue:retry, queue:forget behave. Failures on a transport the bridge doesn't fully implement can vanish silently.pushRaw + JSON when interop matters.php artisan config:cache bakes the DSN in at boot; Context/connection objects are created once per worker. After changing the broker or credentials, restart workers. Run with Supervisor --max-time to force reconnects for AMQP and SQS.SimpleClient or a small Context::createProducer() script) against the same DSN — that isolates "bridge config wrong" from "broker/network wrong". Then check broker metrics/logs and storage/logs/laravel.log for failed-job and exception traces.Interop\Queue\Context in your own service provider for transport-specific options; register a custom queue connection driver if you need to wrap the driver; and keep the config/enqueue.php transports map small and documented per environment.queue-interop / enqueue/* have had breaking interop versions; an unpinned composer update that bumps a transport can break the bridge. Use composer.lock and update the bridge and transports together.How can I help you explore Laravel packages today?