- Improved CLI Interactive readline shell (Johannes)
. Added cli.pager ini setting to set a pager for output.
. Added cli.prompt ini settingto configure the shell prompt.
. Added shortcut #inisetting=value to change ini settings at run-time.
. Don't terminate shell on fatal errors.
A pager can be a an shell command which will receive the command output on its
php > #cli.pager=less
php > phpinfo();
(output will appear in the pager)
php > #cli.pager=grep -i readline
php > phpcredits();
Readline => Thies C. Arntzen
php > #cli.pager=
(output appears again direct on the terminal)
A prompt can contain a few escape sequences like
php > #cli.prompt=\e[032m\v \e[031m\b \e[34m\> \e[0m
5.3.99-dev php > //Colorful prompt with version number
A prompt can also contaian PHP code in backticks
php > #cli.prompt=`echo gethostname();` \b \>
guybrush php >
But I assume a screenshot is quite useful, so here it goes:
So what doyou need to use this feature? - PHP trunk compiled using --with-readline or --with-libedit.The PHP Documentation has information about the interactive mode, the new features will be added once trunk is closer to a release and it's clear in what release this will appear.
Due to a recent discussion on IRC I just found out that it's now exactly three years since I first wrote a mail, including a patch, to the PHP internals list. The patch tried to use STDERR instead of STDOUT for error messages with PHP CLI. As you can see in that thread the patch was way from being perfect and wasn't accepted and somehow I didn't improve it - even so I got a few good hints... Instead of such a, possibly, useful feature the next thing I did was implementing things nobody really needs in PHP: Operator overloading. The main idea behind that was to learn about PHP internals. That patch got some attention from Marcus who later on helped me by answering my stupid questions about PHP internals and meanwhile became a good friend of mine. Since then I created, with Marcus help, the -a-readline-mode, improved the reflection API and did some other tiny things. My newest toy project, related to PHP internals, is a lua extension - more information will follow when the first release is being published.
You might know the great PHP shell mode we introduced with PHP 5.1. Fedora users can know profit from it using php-cli-5.1.6-3.3.fc6 which is the current stable release. For more information on that great shell mode read my blog post in the other blog. Or, if you have that release or built PHP yourself using --with-readline, just try php -a.