Class yii\shell\ShellController

Inheritanceyii\shell\ShellController » yii\console\Controller
Available since extension's version2.0
Source Code https://github.com/yiisoft/yii2-shell/blob/master/ShellController.php

Runs interactive shell. That is especially useful when developing an application and you want to try some method of your code.

Public Properties

Hide inherited properties

Property Type Description Defined By
$include array Include file(s) before starting tinker shell yii\shell\ShellController

Public Methods

Hide inherited methods

Method Description Defined By
actionIndex() Runs interactive shell yii\shell\ShellController
options() yii\shell\ShellController

Protected Methods

Hide inherited methods

Method Description Defined By
getCasters() yii\shell\ShellController

Property Details

Hide inherited properties

$include public property

Include file(s) before starting tinker shell

public array $include = []

Method Details

Hide inherited methods

actionIndex() public method

Runs interactive shell

public void actionIndex ( )

                public function actionIndex()
{
    $config = new Configuration;
    $config->getPresenter()->addCasters(
        $this->getCasters()
    );
    $shell = new Shell($config);
    $shell->setIncludes($this->include);
    $shell->run();
}

            
getCasters() protected method

protected array getCasters ( )
return array

Casters for psysh

                protected function getCasters()
{
    return [
        'yii\db\ActiveRecord' => 'yii\shell\YiiCaster::castModel',
    ];
}

            
options() public method

public void options ( $actionID )
$actionID

                public function options($actionID)
{
    return array_merge(parent::options($actionID), [
        'include'
    ]);
}