Finally a real PHP Shell

After working with Python for a while and enjoying the pleasure of having a shell where you can test your code before you actually programm it I came back to PHP and missed the shell big time. Especially when you don’t exactly know how to use special objects or functions. Now the pain of not having such a shell is over, Jan wrote the real shell for PHP. Thanks a lot. This will make testing and just playing with PHP so much easier. It provides of course auto loading of classes.

Install
Download the actual PHP_Shell class here, and rename the file to “.php”. Download the php-shell script, that you want to start later, from the command line here, rename it to “*.php” too.
To make it callable from the command line using “php-shell” you might want remove the “.php” from the later file too and put either both in one directory that is globally reachable (that is in your PATH). The other opportunity, when you don’t want the PHP_Shell file in you bin-directory, would be to put the PHP_Shell class in the include_path, but then you have to adjust the php-shell script to not include the PHP_Shell from “./PHP_Shell”, but as “PHP_Shell”.

Have fun …

7 Comments »

  1. Davey said,

    May 6, 2006 at 2:46 am

    Uh….
    ====
    >php -a
    Interactive mode enabled

  2. Wolfram said,

    May 6, 2006 at 3:02 am

    Davey: see here http://jan.kneschke.de/projects/php-shell/
    The way the Python shell works is more comfortable, that’s what Jan has implemented for PHP.

  3. jim said,

    May 6, 2006 at 4:40 am

    pretty neat. :)
    i wouldn’t called a shell however, a console rather.

  4. Pierre said,

    May 6, 2006 at 2:16 pm

    I did not try Jan’s console yet. Howeverm I can imagine a better interactive mode. Can you be more explicit than “more confortable”? It is not that hard to extend or enhance the interactive mode in CLI.

  5. Antti Holvikari said,

    May 6, 2006 at 2:23 pm

    This is *TOTALLY* awesome! Just perfect. :-)

  6. Johannes said,

    May 6, 2006 at 4:58 pm

    Just see here to get an interactive PHP shell with tab-completion and all the cool realdine features: http://blog.thinkphp.de/archives/44-More-PHP-power-on-the-command-line.html

  7. Jan Kneschke said,

    May 8, 2006 at 2:34 pm

    Pierre, Dave,

    I named the missing pieces of php -a on http://jan.kneschke.de/projects/php-shell/ . Basicly it is around: missing handling of FATAL errors, no auto-print, no windows support as it requires CLI + readline.

    As it is in PHP it is easily extensible and works with all PHP installations from PHP 4.3.x upwards.

RSS feed for comments on this post · TrackBack URL

Leave a Comment