spiral/queue
Spiral Queue provides a unified API to enqueue and process background jobs in Spiral apps, with drivers for popular backends, configurable workers, retries, and delayed execution. Use it to offload emails, imports, and other long-running tasks.
This package is not intended for direct use in Laravel projects. It’s a read-only mirror of queue functionality tightly coupled to the Spiral framework and RoadRunner server. If you're using Laravel, do not install spiral/queue—it is incompatible with Laravel’s Illuminate\Contracts\Queue contract, job serialization, and queue driver ecosystem. For background jobs in Laravel, use the built-in queue system (with Redis, database, or SQS) and optionally integrate with RoadRunner only at the server level via the official laravel/roadrunner package (which handles HTTP server configuration, not queue logic).
If you are using Spiral (e.g., via spiral/roadrunner), begin by:
rr) and enabling the PHP worker extension.spiral/roadrunner (which transitively includes queue capabilities)..rr.yaml, defining brokers (e.g., redis, amqp) and job handlers.Spiral\Queue\JobInterface or using provided traits.Spiral\Queue\QueueInterface and call $queue->push($job) or $queue->delay($seconds, $job). Avoid blocking calls in HTTP requests—enqueue for async processing..rr.yaml under queues.handlers, mapping job classes to handler classes implementing Spiral\Queue\HandlerInterface. Use dependency injection in handlers via Spiral’s container.amqp: {numWorkers: 8}) to match throughput needs. Prefer Redis or RabbitMQ for reliability.Spiral\Queue\JobGraph (advanced) to chain dependent jobs—only if idempotency and failure recovery are well-architected.Spiral\Queue\Testing\QueueSpy to assert dispatched jobs without sending to actual brokers.spiral/queue ≠ laravel/queue. Mixing them requires rewriting all queue logic—avoid entirely unless migrating to Spiral.retries: 3 per broker). Ensure jobs implement Spiral\Queue\RetryableJobInterface and handle Spiral\Queue\RetryException.log: {level: debug} and /metrics endpoint..rr.yaml in the current directory. Always specify -c path/to/.rr.yaml in scripts to avoid environment mismatches.spiral/roadrunner. Always check RoadRunner’s Changelog for breaking changes—even patch updates may alter queue behavior.How can I help you explore Laravel packages today?