At the moment this library provides the ability to add jobs to the Bull Queue.
- PHP 7.4+
- PhpRedis (default) or Predis
- ramsey/uuid
You can install the package via composer:
composer require ilzrv/php-bull-queue
To add a job to the queue, you can use the following example:
<?php
use Ilzrv\PhpBullQueue\Queue;
$videoQueue = new Queue('videoQueue');
$videoQueue->add(Queue::DEFAULT_JOB_NAME, [
'video' => 'http://example.com/video1.mov'
]);
If you want to use predis
as Redis client (example configuration):
<?php
use Ilzrv\PhpBullQueue\Queue;
use Ilzrv\PhpBullQueue\DTOs\QueueOpts;
use Ilzrv\PhpBullQueue\DTOs\RedisConfig;
$videoQueue = new Queue(
'videoQueue',
new QueueOpts([
'redis' => new RedisConfig([
'client' => 'predis',
'host' => '127.0.0.1',
'port' => 6379,
'password' => '',
]),
])
);
$videoQueue->add(Queue::DEFAULT_JOB_NAME, [
'video' => 'http://example.com/video1.mov'
]);
All is configured via classes:
Ilzrv\PhpBullQueue\DTOs\RedisConfig
Ilzrv\PhpBullQueue\DTOs\QueueOpts
Ilzrv\PhpBullQueue\DTOs\JobOpts
client
(string) Redis client. Can bephpredis
orpredis
. Default:phpredis
host
(string) Redis host. Default:127.0.0.1
port
(int) Redis port. Default:6379
password
(string) Redis password. Default:''
redis
(RedisConfig Object) Redis Configuration.prefix
(string) Queue prefix. Default:bull
customJobId
(string) Custom JobId. Default:0
priority
(int) Job priority. Default:0
lifo
(bool) Last In, First Out. Default:false
attempts
(int) Job attempts. Default:1
timestamp
(int) Current timestamp.delay
(int) Job delay. Default:0
The MIT License (MIT). Please see License File for more information.