phpshell 0.1

July 17, 2009

This is kind of weird, but maybe somewhat useful some day. Looking for a quick way to test out PHP code, I ended up writing a small PHP “shell” (i.e. like IRB):

It comes with some useful shortcuts:

  • e() print’s anything to the screen, including arrays (through print_r())
  • man() prints the entire manual page of a function. This requires that you have PHP Function Index installed.
  • fi() opens a command in PHP Function Index
  • d() reads stuff from the defaults database
  • Entering a function name without the paranthesis gives a short 20 line explanation of the command from the manual

There are some limitations - it requires PHP with readline support (which MAMP doesn’t have, not to mention Apple’s stock PHP) and links to render the HTML pages. Both can be installed through MacPorts (PHP would just need the +readline variant).

If nothing else, it’s pretty interesting little experiment. Normal people would probably be better off using PHP Console instead. ;-)