addListener(Shell::EVT_UPDATE_PROMPT, function ($event) { $name = $event->shell->getContextPath(); $event->shell->setPrompt("shell{$name}> "); }); class MyContext extends Context { public function __construct() { // Remember to call the parent constructor if you want to use // the doccomment syntax to mark commands, as demonstrated // at the end of this class for the bar command. parent::__construct(); $this->addCommand("foo",[$this,"foo"],[ 'help' => "Foo command" ]); } public function onEnter() { echo "Entering context!\n"; } public function foo() { echo "Foo!\n"; } /** * @command bar * @args * @help Bar command */ public function bar() { echo "Bar!\n"; } } $shell->pushContext(new MyContext()); $shell->run();