asolomatin/php-console-yii2

此包最新版本(dev-master)没有提供许可信息。

Yii2的PhpConsole包装器

dev-master 2017-08-21 08:20 UTC

This package is auto-updated.

Last update: 2024-09-18 08:32:18 UTC


README

Yii 2的PhpConsole包装器

基于 https://github.com/barbushin/php-console-yii

配置示例

在 common/main.php 的 'components' => [ 'phpconsole' => [ 'class' => '\nilsburg\PhpConsole\PhpConsole', 'isEvalEnabled' => true, 'password' => 'some_password' ], ]

使用(评估)

public function beforeAction($action)
{
    if ($action->id === 'index') {
        $this->enableCsrfValidation = false;
    }
    return parent::beforeAction($action);
}

public function actionIndex()
{
    $console = \Yii::$app->phpconsole;
    unset($console);
    return $this->render('index');
}