Yii 2.0: yii2-console-runner

Runs console command in yii web application
3 followers

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

Resources

Total 1 comment

#19391 report it
Daniel at 2015/06/15 06:31pm
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

Leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet