hauntd / yii2-queue

Yii2 Queue Extension

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Queue Extension for Yii2

Extension for async execution of jobs through a queue mechanism.

Documentation is at docs/guide/README.md.

Latest Stable Version Total Downloads Build 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('channel', new DownloadJob([
    'url' => 'http://example.com/image.jpg',
    'file' => '/tmp/image.jpg',
]));

For more details see the guide.

About

Yii2 Queue Extension


Languages

Language:PHP 100.0%