catch-of-the-day/php-resque
Redis-backed background job queue for PHP (Resque port). Enqueue jobs onto one or more prioritized queues and process them with distributed workers. Supports forking for leak resilience, failure handling, optional job status tracking, and setUp/tearDown hooks.
Illuminate\Queue contract, requiring a wrapper layer or custom queue driver.serialize() for job payloads, which may cause issues with complex objects (e.g., closures, resources). Laravel’s Illuminate\Contracts\Queue\ShouldBeQueued expects JSON-serializable payloads by default.php artisan queue:work) are incompatible with php-resque’s fork-based model. Requires custom CLI scripts or process managers (e.g., Supervisor).php-resque works, some features (e.g., process titles) rely on PECL extensions or PHP 5.5+.onFailure hooks to mirror Laravel’s retry/fail mechanisms.PREFIX env var). Must align with Laravel’s existing Redis keys (e.g., laravel:queue:failed) to avoid collisions.Why not Laravel’s Native Queues?
php-resque offer unique features (e.g., setUp/tearDown, fine-grained job status tracking) not available in Laravel’s database/redis drivers?Worker Lifecycle Management
queue:work?Compatibility with Laravel Ecosystem
php-resque jobs be triggered via Laravel’s dispatch() or dispatchSync()?ShouldBeQueued objects) be serialized/deserialized?Monitoring and Observability
STATUS_WAITING, STATUS_FAILED) be surfaced to Laravel’s monitoring tools (e.g., Horizon, Telescope)?Scaling and Concurrency
proctitle) for full feature parity.queue:work (via custom queue driver or wrapper).Phase 1: Proof of Concept
php-resque queue driver for Laravel (extending Illuminate\Queue\RedisQueue).SendEmailJob).Phase 2: Worker Integration
queue:work with custom php-resque scripts (e.g., bin/resque).onFailure hooks to log to Laravel’s failed_jobs table).Phase 3: Feature Parity
Illuminate\Queue\Events\JobProcessed).Phase 4: Optimization
RetryAfterFailedJobs).| Feature | Laravel Native Queues | php-resque |
Integration Notes |
|---|---|---|---|
| Job Serialization | JSON | PHP serialize() |
Risk: Complex objects may fail. |
| Retry Mechanism | Built-in | Manual | Requires onFailure hooks. |
| Delayed Jobs | Supported | Not documented | May need custom implementation. |
| Middleware | Supported | No | Would require wrapper layer. |
| Horizon Monitoring | Native | No | Custom UI or Redis scraping needed. |
| Forking Model | Single-process | Multi-fork | Supervisor required for stability. |
Start with a Single Queue
emails) to php-resque.Add Critical Path Jobs Gradually
report-generators).Implement Observability Early
failed_jobs table via onFailure hooks.Phase Out Native Drivers
php-resque wrapper.proctitle) for process titles.php-resque is unmaintained (last commit ~2015). Fork or maintain a patched version.VERBOSE, VVERBOSE) may not integrate with Laravel’s log channels. Redirect to storage/logs/resque.log.onFailure hooks to trigger Laravel’s failed event).php-resque).memory_limit (forking may exacerbate leaks).COUNT env var if jobs are memory-intensive.| Scenario | Impact | Mitigation Strategy |
|---|---|---|
| Redis connection drops | Jobs stuck in queue | Implement exponential backoff in workers. |
| Worker crashes | Unprocessed jobs | Supervisor auto-restart + dead-letter queue. |
| Job timeouts | Failed jobs | Set timeout in job class or worker config. |
How can I help you explore Laravel packages today?