addOption("list", null, InputOption::VALUE_NONE, "List the available scripts"); $this->addArgument("script", InputArgument::OPTIONAL, "The script too run (see --list)"); $this->addArgument("args", InputArgument::OPTIONAL|InputArgument::IS_ARRAY, "Arguments to the script"); } protected function execute(InputInterface $input, OutputInterface $output) { $env = $this->getEnvironment(); while (true) { $cmd = readline("repl> "); if ($cmd) readline_add_history($cmd); try { $ret = @eval("return {$cmd};"); //$output->writeln(json_encode($ret,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); //$output->writeln("".var_export($ret,true).""); dump($ret); } catch (\Throwable $t) { $output->writeln("".$t->getMessage().""); } } return Command::SUCCESS; } }