Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Resque Bundle Laravel Package

mcfedr/resque-bundle

Symfony bundle that integrates the Resque PHP job queue with your Symfony application, letting you dispatch background jobs, run workers, and manage queues through a familiar configuration-driven setup.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install and check constraints first. composer require mcfedr/resque-bundle — before you commit, open the bundle's composer.json and confirm its Symfony constraint matches your app. This is a low-traffic package (9 stars, no dependents), so assume it targets an older Symfony (2.x/3.x/early 4.x) until proven otherwise.

  2. Register the bundle. Classic Symfony: add new Mcfedr\ResqueBundle\McfedrResqueBundle() to AppKernel. Flex-era: add it to config/bundles.php.

  3. Point it at Redis. The bundle's config lives under its extension alias (typically mcfedr_resque); read DependencyInjection/Configuration.php for the exact keys:

    mcfedr_resque:
        redis:
            host: '%env(REDIS_HOST)%'
            port: 6379
            database: 0
            namespace: 'resque'
    
  4. First use case — enqueue one job. Create a job class and fire it from a controller or service:

    $resque = $this->get('mcfedr_resque'); // verify service id in Resources/config/services.xml
    $resque->enqueue('default', SendWelcomeEmail::class, [$userId]);
    
  5. Start a worker. Run bin/console list resque to discover the actual command names (worker/queue commands live in the bundle's Command/ directory), then start one against your queue.

Where to look first: DependencyInjection/Configuration.php for all config keys, Command/ for worker behaviour, and the chrisboulton/php-resque README — this bundle is a thin Symfony wrapper around that library, so upstream docs explain 80% of behaviour.

Implementation Patterns

  • Job classes as services. The day-to-day value of the bundle is container-aware job execution. Register job classes as services and let the bundle's job factory resolve them, so perform() gets constructor injection (repositories, mailers, loggers) instead of new $class. If the bundle version you have doesn't wire this, subclass/override the job factory — that's the main extension point.
  • Enqueue from services, not controllers. Wrap enqueuing in an application service (JobDispatcher) so queues are named in one place and are easy to assert in tests. Keep controller code to $dispatcher->sendWelcomeEmail($user).
  • Queue-per-concern, consumed in priority order. Use mail, imports, default; run one worker per queue under Supervisor/systemd rather than one worker for everything. A single worker taking mail,default serialises unrelated failures.
  • Deploy-safe job contracts. Job args are JSON; pass scalars or a DTO that explicitly implements toArray()/fromArray(). Include a jobVersion field in payloads so you can reject or migrate stale jobs after a deploy.
  • Explicit retries. php-resque does not retry automatically. Catch in perform(), re-enqueue with an incremented attempt count, and after N attempts push to a dead-letter queue or the failure backend. Do it once, in a base job class.
  • Failure handling. Use php-resque's Redis failure backend plus (if present) the bundle's events to route failures into your existing logger/Sentry/alerting. Without this, failures are invisible until someone inspects Redis.
  • Testing. Swap the mcfedr_resque service for a fake in the test container that records enqueues; test the job's perform() directly with real dependencies. Add one integration test against a real Redis to catch serialization regressions.

Gotchas and Tips

  • Maintenance risk is the headline. Check last commit/release and PHP version support. php-resque predates PHP 8's stricter semantics and may throw deprecations or break on modern Symfony. Budget for a fork or a migration path before betting production work on it.
  • pcntl/posix required. Workers fork; this does not work on Windows and often fails on restricted shared hosting. Verify extension_loaded('pcntl') in the target environment.
  • Namespace/database mismatch is the #1 silent failure. Enqueuer and worker must share the same Redis host, database and namespace. If a job "vanishes", check redis-cli -n 0 keys 'resque*' first.
  • Worker code is loaded once. After every deploy, gracefully restart workers (SIGTERM/SIGQUIT to let the current job finish; don't SIGKILL mid-job). Stale workers executing old class definitions cause the weirdest bugs.
  • FQCN is part of the wire format. Renaming/moving a job class breaks in-flight jobs. Keep a stable alias map in the job factory if you refactor often.
  • No scheduler, uniqueness, or delayed jobs out of the box. You'll bolt these on with cron + resque-scheduler or your own enqueueAt. Don't assume Horizon-style features.
  • Debugging toolkit: redis-cli for resque:queues, resque:queue:<name>, resque:failed; worker verbosity flags for stdout; pipe worker output into your log shipper since php-resque only logs to stdout.
  • Compare before committing. For new work, Symfony Messenger (or Laravel Queues/Horizon, if you're coming from that world) gives you retries, failure transport, DI, and monitoring for free. Choose this bundle only when you specifically need Resque interop with existing Ruby/Node consumers or legacy infrastructure.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource