zhuravljov/yii2-queue Yii2 Queue Extension which supported DB, Redis, RabbitMQ, Beanstalk and Gearman

redisqueuedbasyncrabbitmqgearmanbeanstalk

Yii2 Queue Extension

An extension for running tasks asyncronously via queues.

It supported queues based on DB, Redis, RabbitMQ, Beanstalk and Gearman.

Documentation is at https://github.com/zhuravljov/yii2-queue/blob/master/docs/guide/README.md.

Latest Stable VersionTotal DownloadsBuild Status

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist zhuravljov/yii2-queue

or add

"zhuravljov/yii2-queue": "*"

to the require section of your composer.json file.

Basic Usage

Job class example:

class DownloadJob extends Object implements \zhuravljov\yii\queue\Job
{
    public $url;
    public $file;

    public function run()
    {
        file_put_contents($this->file, file_get_contents($this->url));
    }
}

Pushes job into queue:

Yii::$app->queue->push(new DownloadJob([
    'url' => 'http://example.com/image.jpg',
    'file' => '/tmp/image.jpg',
]));

Method of handling a queue depend on selected driver.

Pushes job into queue that run after 5 min:

Yii::$app->queue->later(new DownloadJob([
    'url' => 'http://example.com/image.jpg',
    'file' => '/tmp/image.jpg',
]), 5 * 60);

But only some drivers support delayed running.

For more details see the guide.

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



0.12.2 is the latest of 21 releases



BSD-3-Clause license
Stats
157 github stars & 22 github forks
3 downloads in the last day
1028 downloads in the last 30 days
2760 total downloads