- What is mcfedr/php-resque used for?
- mcfedr/php-resque is a PHP port of Resque for processing background jobs through Redis. You use it to enqueue work from your application, run worker processes that pull jobs from Redis queues, and handle job failures. It is useful when you want a Resque-style queue and worker model in PHP rather than a framework-specific queue system.
- How do I install mcfedr/php-resque with Composer?
- Install it as a Composer dependency with composer require mcfedr/php-resque. You will also need a Redis server available and the package's Redis connection settings configured for your environment. Check the package's README and composer.json for the exact PHP extension and dependency requirements before installing.
- Does mcfedr/php-resque work with Laravel?
- Yes, it can be used inside a Laravel application because it is a Composer-installable PHP package, but it is not a native Laravel queue driver. You would enqueue jobs and run workers alongside Laravel rather than using the Laravel queue API unless you build your own integration. For a Laravel-native Redis queue with dashboards and retries, Laravel's queue system and Horizon are usually a better fit.
- How does mcfedr/php-resque use Redis?
- It uses Redis as the backing store for queues and job payloads, following the Resque model. Producers push job data into Redis queues, and worker processes pop and execute those jobs. Redis also holds queue state and failure records when a failure backend is configured.
- How do I start a worker for mcfedr/php-resque?
- Workers are long-running PHP processes that connect to Redis and process one or more queues. Start them using the worker entry point or script shipped with the package, and pass the queue names and Redis configuration your application uses. In production, supervise workers with a process manager so they restart after crashes or deploys.
- How are failed jobs handled in php-resque?
- Resque-style systems record failed jobs in Redis through a failure backend so they can be inspected and retried. You should configure a failure backend and make sure your job classes surface exceptions cleanly. Requeue or investigate failed jobs rather than letting them disappear silently.
- Can I run multiple php-resque workers or scale them?
- Yes, the Resque worker model is designed for multiple worker processes consuming from the same Redis queues. You can start additional workers on one server or across several servers to increase throughput. Keep an eye on Redis capacity, job idempotency, and worker supervision as you scale.
- How do I test jobs queued with mcfedr/php-resque?
- Use a separate Redis database or test instance so tests do not touch production queues. You can enqueue jobs and assert on Redis queue contents, or run a worker in an integration test to verify execution. Keep unit tests for job logic separate from slower worker integration tests.
- Is mcfedr/php-resque maintained, and what are the alternatives?
- Maintenance should be verified on Packagist and the project repository by checking recent releases, open issues, and PHP version support. Alternatives include Laravel's built-in Redis queue with Horizon, other PHP queue packages, and original Resque in Ruby. Choose based on whether you need a Resque-style API or deeper Laravel integration.
- What production concerns should I consider with php-resque?
- Plan for worker supervision, graceful shutdown during deploys, Redis persistence and memory limits, and visibility into failed jobs. Make jobs idempotent where possible because retries and duplicate processing can happen. Also monitor queue depth and worker health so backlog does not grow unnoticed.