PHP code example of cbackup / yii2-console-runner-extension

1. Go to this page and download the library: Download cbackup/yii2-console-runner-extension 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/ */

    

cbackup / yii2-console-runner-extension example snippets


use cbackup\console;
$cr = new ConsoleRunner(['file' => '@my/path/to/yii']);
$cr->run('controller/action param1 param2 ...');

// config.php
...
components [
    'consoleRunner' => [
        'class' => 'cbackup\console\ConsoleRunner',
        'file'  => '@my/path/to/yii' // or an absolute path to console file
    ]
]
...

// some-file.php
Yii::$app->consoleRunner->run('controller/action param1 param2 ...');