1. Go to this page and download the library: Download dejvidecz/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/ */
dejvidecz / 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 queue and get message ID.
$id = Yii::$app->queue->push(new SomeJob());
// The job is waiting for execute.
Yii::$app->queue->isWaiting($id);
// Worker gets the job from queue, and executing it.
Yii::$app->queue->isReserved($id);
// 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.