helpers.php
Table of Contents
Functions
- dispatch() : string
- Dispatch a job to the queue for background processing
- dispatchNow() : mixed
- Execute a job immediately (synchronously), bypassing the queue
- getQueueManager() : QueueManager
- Get the queue manager instance from registry
- queueSize() : int
- Get the size of a queue
- clearQueue() : int
- Clear all jobs from a queue
Functions
dispatch()
Dispatch a job to the queue for background processing
dispatch(IJob $job[, array<string|int, mixed> $args = [] ][, string|null $queue = null ][, int $delay = 0 ]) : string
Parameters
- $job : IJob
-
Job instance to queue
- $args : array<string|int, mixed> = []
-
Arguments to pass to the job
- $queue : string|null = null
-
Queue name (null = default)
- $delay : int = 0
-
Delay in seconds before job is available
Tags
Return values
string —Job ID
dispatchNow()
Execute a job immediately (synchronously), bypassing the queue
dispatchNow(IJob $job[, array<string|int, mixed> $args = [] ]) : mixed
Useful for testing or when you want to ensure a job runs in the current process without queueing.
Parameters
- $job : IJob
-
Job instance to execute
- $args : array<string|int, mixed> = []
-
Arguments to pass to the job
Tags
Return values
mixed —Job result
getQueueManager()
Get the queue manager instance from registry
getQueueManager() : QueueManager
Creates a new instance if one doesn't exist.
Return values
QueueManagerqueueSize()
Get the size of a queue
queueSize([string|null $queue = null ]) : int
Parameters
- $queue : string|null = null
-
Queue name (null = default)
Tags
Return values
int —Number of jobs in queue
clearQueue()
Clear all jobs from a queue
clearQueue([string|null $queue = null ]) : int
Parameters
- $queue : string|null = null
-
Queue name (null = default)
Tags
Return values
int —Number of jobs cleared