Skip to main content

Creating a Queue

Adding Jobs

Basic Job

Delayed Job

Priority Job

Custom Job ID

Job with Retry Settings

Job with Removal Policy

LIFO (Last In, First Out)

Adding Multiple Jobs

Job Options Reference

Getting Job Information

Get a Specific Job

Get Jobs by State

Get Job Counts

Get Count by Type

Get Counts by Priority

Queue Management

Pause and Resume

Remove a Job

Clean Old Jobs

Retry Failed Jobs

Promote Delayed Jobs

Drain the Queue

Obliterate the Queue

Parent-Child Jobs (Flows)

Job States

Jobs can be in one of the following states:
  • waiting - Job is waiting to be processed
  • active - Job is currently being processed
  • delayed - Job is delayed and waiting for its delay to expire
  • completed - Job has been successfully processed
  • failed - Job has failed after all retry attempts
  • paused - Job is in a paused queue
  • prioritized - Job is in the prioritized set
  • waiting-children - Parent job waiting for child jobs to complete

Connection Management

Using a Connection Array

Using a Redis URI

Sharing a Connection

Custom Prefix

Close Connection

Complete Example

Interoperability with Workers

Jobs added via PHP can be processed by workers in other languages:

Node.js Worker

Python Worker

Elixir Worker

Best Practices

  1. Reuse connections - Share RedisConnection instances across queues
  2. Close connections - Call $queue->close() when done
  3. Use meaningful job names - Makes debugging easier
  4. Set appropriate retry attempts - Not all jobs should retry infinitely
  5. Use custom job IDs - For idempotency and deduplication
  6. Clean old jobs - Regularly clean completed/failed jobs to save memory
  7. Handle errors gracefully - Wrap queue operations in try-catch blocks
  8. Use bulk operations - When adding multiple jobs, use addBulk()

Error Handling

View Changelog

See what’s new in the latest version