File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed
Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ # Yii2 Shell
2+
3+ The Yii shell provides a [ REPL] ( https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop ) for the application.
4+ This can be useful in experimenting with code or evaluating behavior from within the application.
5+
6+ This is provided by the YiiSoft [ yii2-shell] ( https://github.com/yiisoft/yii2-shell ) project.
7+
8+ ## Usage
9+
10+ The shell is available via the Yii CLI with ` console/yii shell ` . This will provide a prompt that evaluates PHP code in the context of a
11+ fully bootstrapped application.
12+ In common usage, it is likely preferable to access this via one of the Docker containers like ` docker exec -it sourcetoad_core_php console/yii shell ` .
13+ This allows for Docker based routing to the database container and the Station/Satellite pair.
14+
15+ ## Features
16+
17+ ### Shell Specific Commands
18+
19+ The shell makes available a number of specific commands.
20+ ![ help] ( ./assets/help.png )
21+
22+ ` dump ` provides a well organized and readable dump.
23+ ![ dump] ( ./assets/dump.png )
24+
25+ An input history is kept locally and can be navigated via the arrow keys, similar to bash.
26+
27+ ## Caveats
28+
29+ While classes are autoloaded they must be referenced via full namespaces. If working in a particular namespace this can
30+ be assigned.
31+
32+ ` $asset = new common\modules\media\models\Asset() `
33+
34+ versus
35+
36+ ``` php
37+ namespace common\modules\media;
38+ $asset = new models\Asset();
39+ ```
You can’t perform that action at this time.
0 commit comments