PHP code example of fk / queue

1. Go to this page and download the library: Download fk/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/ */

    

fk / queue example snippets


# main.php
return [
    'components' => [
        'queue' => [
            'class' => 'fk\queue\wrapper\yii2\Connection',
            'logPath' => '@console/runtime/logs/queue.log',
            'engine' => 'fk\queue\engines\Redis',
        ]
    ]
]

Yii::$app->queue->in('ls -l'); // bash> ls -l
Yii::$app->queue->in(new YiiCommand(['migrate'])); // bash> php yii migrate

# console\config\main.php
return [
    'controllerMap' => [
        'queue' => [
            'class' => 'fk\queue\wrapper\yii2\QueueController'
        ]
    ],
]

php yii queue/start



class MyCommand extends \fk\queue\commands\Command
{

    public $command;

    public function parse() {
        // Parse your command with its property `command`
    }
}