, (*1)
Interactive Shell Extension for Yii 2
This extension provides an interactive shell for Yii framework 2.0 based on psysh., (*2)
For license information check the LICENSE-file., (*3)
, (*4)
Installation
The preferred way to install this extension is through composer., (*5)
Either run, (*6)
composer require yiisoft/yii2-shell
or add, (*7)
"yiisoft/yii2-shell": "~2.0.0"
to the require
section of your composer.json., (*8)
Usage
After installation, you will be able to run the interactive shell via command line:, (*9)
# Change path to your application's root directory
cd path/to/myapp
# Start the interactive shell
./yii shell
You can access the application object using Yii::$app
. Additionally you have access to all your and your dependencies' classes., (*10)
See psysh's website for a list of available features., (*11)
Configuration
You can configure the PsySH shell by setting options via the shellConfig
variable in the controller, i.e. add this to your console application configuration:, (*12)
'controllerMap' => [
'shell' => [
'shellConfig' => [
'updateCheck' => 'weekly',
'verbosity' => \Psy\Configuration::VERBOSITY_VERBOSE,
],
],
],
See https://github.com/bobthecow/psysh/wiki/Config-options for a list of PsySH configurable options., (*13)
Note: updateCheck
is explictly set to never by yii2-shell. All other PsySH options use default values., (*14)
Screenshot
The following screenshot shows a usage example:, (*15)
, (*16)