edofre/yii2-command-caller

Yii2 命令调用器

安装: 13

依赖项: 0

建议者: 0

安全: 0

星标: 1

关注者: 2

分支: 0

开放问题: 0

类型:yii2-extension

V1.0.1 2017-10-26 13:07 UTC

This package is not auto-updated.

Last update: 2024-09-15 04:05:34 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock

安装

安装此扩展的首选方式是通过 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');