toriphes/yii2-console-runner

在yii web应用程序中运行控制台命令

安装次数: 178,987

依赖者: 1

建议者: 0

安全性: 0

星标: 28

关注者: 7

分支: 9

开放性问题: 0

类型:yii2-extension

1.2.1 2018-08-27 13:06 UTC

This package is not auto-updated.

Last update: 2024-09-14 17:32:04 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

这是一个用于在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