This is component for running console command in yii2 web applications
This extension is inspired by the project https://github.com/vova07/yii2-console-runner-extension
Requirements ¶
Yii 2.0+
Installation ¶
The preferred way to install this extension is through composer.
To install, either run
$ composer require toriphes/yii2-console-runner "*"
or add
"toriphes/yii2-console-runner": "*"
to the `
require`
section of your composer.json
file.
Usage ¶
You can user yii2-console-runner importing the class file
use toriphes\console\Runner;
$output = '';
$runner = new Runner();
$runner->run('controller/action param1 param2 ...', $output);
echo $output; //prints the command output
or using it like an application component:
//your 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
Long running console command
I have an app to calculate the fines of school fee. Since this is to calculate for more than 5000 students, I need to be able to run it for long time (approx 2-3 minutes).
Currently, I am using normal web app, with a work around by using ajax, call for every 500 students. Otherwise, I will get into time out.
Is this extension able to be run for a long time? Or at least just trigger the command without waiting for the result? I don't mind not to see the progress of the calculation.
Thank you,
Daniel
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.