Enqueue jobs from PHP

A PHP client for BullMQ. Add jobs to a queue from your PHP application and process them with workers written in Node.js, Python or Elixir.

Download the latest bullmq-php-x.y.z.zip from the GitHub releases and unzip it in your project root. Then run:

composer config repositories.bullmq path "./bullmq-php-*" composer require "taskforcesh/bullmq-php:*"

The package is not on Packagist yet. See the installation guide for other options.

PHP 8.1+ · Composer · Redis 5.0+ (6.2+ recommended)

Your first queue and worker

The PHP library only adds jobs to queues. The jobs are processed by workers written in Node.js, Python or Elixir.

my_queue.php
use BullMQ\Queue;

$queue = new Queue("Paint");
$job = $queue->add("cars", [
"color" => "blue",
"delay" => 30000
]);

The same job handling as the Node.js library

All BullMQ libraries run the same Lua scripts on Redis and the same SQL on PostgreSQL, so jobs are handled the same way in every language. Only the API around those scripts differs from one library to the next.

More PHP examples

Common BullMQ features, written in PHP.

Repeatable jobs

repeatable.php
use BullMQ\Queue;

$queue = new Queue("Paint");

// Repeat job once every day at 3:15 (am)
$job = $queue->add(
"submarine",
["color" => "yellow"],
[
"repeat" => [
"pattern" => "0 15 3 * * *"
]
]
);

Retries & backoff

retry.php
use BullMQ\Queue;

$queue = new Queue("Paint");

$job = $queue->add(
"car",
["color" => "pink"],
[
"attempts" => 3,
"backoff" => [
"type" => "exponential",
"delay" => 1000
]
]
);

Using BullMQ with PHP

Adds jobs only

The PHP library adds jobs to queues. There is no PHP worker, so the jobs are processed by workers written in Node.js, Python or Elixir.

Any framework

Call it from a Laravel or Symfony controller, a console command or plain PHP to move slow work out of the request.

Same data format

Jobs are stored in the same Redis data structures that every other BullMQ library uses, so any worker can read them.

PHP Node.js, Python or Elixir

One queue, any language

Add jobs from PHP and process them with Node.js, Python or Elixir workers.

What's available in PHP

  • Add jobs to queues Supported
  • Process jobs (workers) Not available
  • Delayed jobs Supported
  • Repeatable / scheduled jobs Supported
  • Job priorities Supported
  • Rate limiting Not available
  • Retries & backoff Supported
  • Flows (parent / child) Not available
  • Job events Not available
  • Redis backend Supported
  • PostgreSQL backend Coming soon
  • BullMQ Pro Coming soon

BullMQ Pro for PHP Coming soon

BullMQ Pro adds groups, observables and batches to the open source library. It is available for Node.js and Bun today, and support for PHP is on the way.

Groups
Observables
Batches

Get started with BullMQ for PHP