Currently MediaWiki provides a custom console via eval.php, which is integrated with the wiki's environment but otherwise rather poor (no proper readline support, no fatal error handling, the P part of REPL is missing, no tab autocompletion, no reflection...). Vagrant provides phpsh / hhvmsh which is somewhat better but still mediocre. It would be nice to replace these with a great REPL like [[ http://psysh.org/ | PsySH ]] or [[ https://changelog.com/meet-boris-a-tiny-repl-for-php/ | Boris ]].
Landed as `maintenance/shell.php`.
Things to maybe improve listed by @tgr:
[ ] Unicode support (T69924 - seems to be a HHVM bug)
[x] get the dependencies to WMF production (https://gerrit.wikimedia.org/r/#/c/339584/)
[x] fix issues (P5001, P5002) with Vagrant: a778ea13, https://gerrit.wikimedia.org/r/#/c/371722
[x] replace/warn for old commands (eval.pgp, phpsh, mwrepl): https://gerrit.wikimedia.org/r/#/c/371723 https://gerrit.wikimedia.org/r/#/c/371760
[ ] use personal readline configuration
[x] preserve readline history between sessions (turned out to be a vagrant bug, see https://gerrit.wikimedia.org/r/#/c/371722 )
[ ] install the PHP docs (so that help and reflection in PsySH works)
[ ] integrate with PSR-3 logging (add a flag to show what has been logged during a command)
[ ] add [[http://php.net/manual/en/language.oop5.magic.php#object.debuginfo|`__debugInfo()`]] to MediaWiki classes (used by [[http://symfony.com/doc/current/components/var_dumper/advanced.html#casters|VarDumper]] which is used by PsySH)
[ ] add a custom tab completion matcher, to support __get-based stuff. (Not sure if there is a good use case for that now. In the future, maybe services defined by extensions?)
[ ] try to interact with the HHVM debugger (breakpoints etc)?