1. Go to this page and download the library: Download zhuravljov/yii2-queue library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zhuravljov / yii2-queue example snippets
class DownloadJob extends BaseObject implements \yii\queue\JobInterface
{
public $url;
public $file;
public function execute($queue)
{
file_put_contents($this->file, file_get_contents($this->url));
}
}
// Push a job into the queue and get a message ID.
$id = Yii::$app->queue->push(new SomeJob());
// Check whether the job is waiting for execution.
Yii::$app->queue->isWaiting($id);
// Check whether a worker got the job from the queue and executes it.
Yii::$app->queue->isReserved($id);
// Check whether a worker has executed the job.
Yii::$app->queue->isDone($id);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.