03 July 2011

Make Your Life as a PHP Developer Twice as Easy With phpsh

I know that this blog is supposed to be mainly about Python but this was just something that I felt needed to be shared regardless. Many of us Python programmers either programmed in PHP at one time or we still do on presently. I use a combination of Ruby, Python, and PHP in my daily work depending on what my clients existing codebase looks like and expect that many of you are no different.

One of the features that I love the most about Python is it's powerful REPL. I love that I can pop over into the console and start testing/fleshing out an idea on the spot. I love being able to test new libraries this way as well which saves me tons of time.

The developers at Facebook have brought PHP developers a powerful REPL now ala-Python to round out a solid toolbox that PHP developers already have. The project is called phpsh and is written in Python.

To give it a go, just clone their git repo to your machine and install the tool via setuptools.

$ git clone git://github.com/facebook/phpsh.git
$ cd phpsh
$ sudo python setup.py install
$ phpsh
Starting php
Install pcntl to enable forking on every command.
type 'h' or 'help' to see instructions & features

Every PHP developer out there that's not aware of this tool is seriously wasting hours upon hours of their time with each project they complete without phpsh. Clone the git repo right now and start enjoying the benefits of an REPL like Python and Ruby developers have enjoyed for the longest time.


  1. PHP already has a builtin interactive shell, what makes phpsh so special?

  2. You don't have to recompile php with readline to support comands history ;)

  3. If that's all, phpsh doesn't offer much.

  4. Cosat,

    Try it out yourself!
    1) Has autocomplete
    2) Built-in docs
    3) Pressing enter instead of typing ";" to end a line
    4) ctrl+d doesn't type ";D5"

    Its far better then php -a, seriously