Skip to content

Yii2 Queue Extension which supported DB, Redis, RabbitMQ and Gearman

Notifications You must be signed in to change notification settings

samdark/yii2-queue

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 Queue Extension

Extension for async execution of jobs through a queue mechanism.

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

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

Method of handling a queue depend on selected driver.

For more details see the guide.

About

Yii2 Queue Extension which supported DB, Redis, RabbitMQ and Gearman

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%