webtoucher / yii2-commands

Yii 2 控制台控制器扩展包装器。

安装次数: 177,252

依赖项: 7

建议者: 0

安全: 0

星标: 1

关注者: 2

分支: 0

开放问题: 0

类型:yii-extension

v1.0.3 2014-07-24 05:13 UTC

This package is auto-updated.

Last update: 2024-09-14 21:21:05 UTC


README

Yii 2 控制台控制器扩展包装器。

安装

安装此扩展的首选方式是通过 composer

运行以下命令之一:

$ php composer.phar require webtoucher/yii2-commands "*"

或者在您的 composer.json 文件的 require 部分添加以下内容:

"webtoucher/yii2-commands": "*"

to the require section of your composer.json file.

使用方法

只需将您的控制台控制器类 webtoucher\commands\Controller 用于替代 yii\console\Controller,如下所示:

<?php

namespace app\components;

use webtoucher\commands\Controller;


class CommandController extends Controller
{
    public function actionRun()
    {
      ...
    }
}

您可以使用 --y 标志运行命令,并自动回答所有确认问题为 'yes'。

$ php yii command --y