toriphes / yii2-console-runner
在yii web应用程序中运行控制台命令
1.2.1
2018-08-27 13:06 UTC
Requires
- yiisoft/yii2: >=2.0.0
This package is not auto-updated.
Last update: 2024-09-14 17:32:04 UTC
README
这是一个用于在yii2 web应用程序中运行控制台命令的组件
安装
安装此扩展的首选方式是通过 composer。
要安装,请运行以下命令之一:
$ composer require toriphes/yii2-console-runner "*"
或添加以下内容到您的 composer.json
文件的 require
部分:
"toriphes/yii2-console-runner": "*"
to the require
section of your composer.json
file.
用法
您可以通过导入类文件或将其用作应用程序组件来使用 yii2-console-runner
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