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
| Option | Type | Description |
|---|---|---|
jobId | string | Custom job ID |
delay | int | Delay in milliseconds before processing |
priority | int | Priority (lower = higher priority) |
attempts | int | Number of retry attempts |
backoff | array/int | Backoff strategy for retries |
lifo | bool | Process newest jobs first |
removeOnComplete | bool/int/array | Remove job on completion |
removeOnFail | bool/int/array | Remove job on failure |
timestamp | int | Job creation timestamp (ms) |
parent | array | Parent job reference for flows |
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 processedactive- Job is currently being processeddelayed- Job is delayed and waiting for its delay to expirecompleted- Job has been successfully processedfailed- Job has failed after all retry attemptspaused- Job is in a paused queueprioritized- Job is in the prioritized setwaiting-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
- Reuse connections - Share RedisConnection instances across queues
- Close connections - Call
$queue->close()when done - Use meaningful job names - Makes debugging easier
- Set appropriate retry attempts - Not all jobs should retry infinitely
- Use custom job IDs - For idempotency and deduplication
- Clean old jobs - Regularly clean completed/failed jobs to save memory
- Handle errors gracefully - Wrap queue operations in try-catch blocks
- Use bulk operations - When adding multiple jobs, use
addBulk()
Error Handling
View Changelog
See what’s new in the latest version
