Dit product is onderdeel van Infowijs - een studio met maarschappelijk hart.
  • PHP reference
  • Queue


class Queue

Add messages to queue to be processed asynchronously.


static boolean dispatch(string $type, array $data = [])

Add a new task to the queue. The first argument is the name of the handler you want to be called, the second any data you might want to pass on.


  • string $type
  • array $data

Return Value

  • boolean

static listen(string $type, callable $callback)

Add a new listener for a queue job type.

Naming convention: Camelcase, using dots to separate subgroups, e.g. 'courses.notifications.markAllRead'

A listener callable should return false to indicate failure executing the job. Any other return value (or no return value) will be regarded as positive, and the job will be marked as completed.

When a job fails or times out, it will be executed again about 90 seconds later.


  • string $type
  • callable $callback

static alias(string $aliasType, string $actualType)

Add an alternative type name (first param) for a existing listener type (second param).

Note that it might be confusing for other programmers if there are a lot of aliases of your listener types, so avoid using this method.


  • string $aliasType
  • string $actualType