Weave Code
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

Queue Laravel Package

illuminate/queue

Illuminate Queue is Laravel’s queue component, offering a unified API for multiple backends to run time‑consuming jobs asynchronously. Use the Capsule manager to configure connections outside Laravel and push jobs via instance or static access.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing illuminate/queue via Composer (composer require illuminate/queue) and initializing a Capsule manager to configure your queue connections. The Capsule API mirrors Laravel’s global service container, making it easy to use outside Laravel apps. Define your first connection (e.g., beanstalkd, redis, or database) in the addConnection() call, then use $queue->push(JobClass, $data) or Queue::push(...) if set as global. The simplest first use case is dispatching a basic job (e.g., a mailable handler) to offload slow tasks from HTTP requests. Check the Laravel docs for the full suite of supported drivers and configuration options.

Implementation Patterns

  • Job Handling: Implement ShouldQueue interface and handle() method on your job classes; use Queue::push() or dispatch() (via Queue::pushOn()/pushRaw() for advanced control).
  • Batching & Chains: Leverage Bus::batch([...])->dispatch() or Bus::chain([...])->dispatch() for grouped or sequential jobs (requires illuminate/bus).
  • Connection Management: Use addConnection('alias', $config) to register named connections, then Queue::connection('alias') for multi-queue setups (e.g., high, low priority).
  • Worker Integration: Pair with php artisan queue:work (if in a Laravel app) or manually run Queue::pop('connection')->process($job) in CLI workers.
  • Event Broadcasting: Connect jobs to event listeners for async notifications or logging (e.g., log failed jobs with Queue::failing(...)).

Gotchas and Tips

  • Driver-Specific Config: database driver requires a jobs table schema (php artisan queue:table && php artisan migrate); redis needs Predis or phpredis; sqs requires AWS credentials.
  • Serialization Quirks: Avoid storing closures in job data (they’re not serializable); use Eloquent models or explicit IDs instead.
  • Timeouts & Retries: Set retry_after in config to prevent jobs from hanging (e.g., 60 for beanstalkd), and use public $tries = 3 on job classes.
  • Testing Tip: Use Queue::fake() in tests to assert dispatched jobs without running workers.
  • Extension Points: Hook into queue lifecycle via Queue::before(), Queue::after(), Queue::looping(), and Queue::afterFailingJob() (Laravel 8+).
  • Subtree Split Limitation: This package is read-only and may lag behind laravel/framework; prefer installing laravel/framework if you’re in a full Laravel app.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport