edofre / yii2-command-caller
Yii2 命令调用器
V1.0.1
2017-10-26 13:07 UTC
Requires
- php: >=5.5.0
- yiisoft/yii2: >=2.0.12
This package is not auto-updated.
Last update: 2024-09-15 04:05:34 UTC
README
安装
安装此扩展的首选方式是通过 composer.
要安装,可以运行
$ php composer.phar require edofre/yii2-command-caller "V1.0.1"
或添加
"edofre/yii2-command-caller": "V1.0.1"
到您的 composer.json
文件的 require
部分。
使用方法
作为应用程序组件
将组件添加到您的配置文件
'components' => [ 'consoleRunner' => [ 'class' => 'edofre\commandcaller\CommandCaller', // Default values, not required 'script' => '@app/yii', 'executable' => '/usr/bin/php', ] ]
// We will change the $result variable in the CommandCaller class Yii::$app->consoleRunner->run('command parameter1 parameter2');
作为单个类
$commandCaller = new \edofre\commandcaller\CommandCaller(); $commandCaller->run('command parameter1 parameter2');