PHP code example of toriphes / yii2-console-runner

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

    

toriphes / yii2-console-runner example snippets


use toriphes\console\Runner;
$output = '';
$runner = new Runner();
$runner->run('controller/action param1 param2 ...', $output);
echo $output; //prints the command output

//you config file
'components' => [
    'consoleRunner' => [
        'class' => 'toriphes\console\Runner'
    ]
]

//some application file
$output = '';
Yii::$app->consoleRunner->run('controller/action param1 param2 ...', $output);
echo $output; //prints the command output