A read-eval-print-loop for php
See the codeThis is an archived project and is no longer supported or updated by Facebook. Please do not file issues or pull-requests against this repo. If you wish to continue to develop this code yourself, we recommend you fork it.
Proceed and be bold!
phpsh is a read-eval-print-loop for php that features readline history, tab completion, and quick access to documentation. It was developed at Facebook and ironically, is written mostly in python. It is open source and released under a modified BSD license.
Mailing list at: http://groups.google.com/group/phpsh
Version:
Modules:
sudo easy_install pysqlitesudo easy_install readlinepypm install readlineNote that this install currently clobbers any previous /etc/phpsh/rc.php
python setup.py buildsudo python setup.py installphpshNote that this install currently clobbers any previous ~/.phpsh/rc.php
python setup.py install --prefix=~export PYTHONPATH=~/lib/python2.6/site-packages (Adjust this if your python minor version differs from 2.6)~/bin/phpshYou will probably want to put the PYTHONPATH line in your .bashrc or such, and just add ~/bin to your PATH as well.
There are more details on installing from a setup.py at http://docs.python.org/library/distutils.html
phpsh and have fun.cd ~/wwwctags -R # for phpsh ctags integration, recommendedphpsh lib/init.php # or some file(s) that load codebase librariescd ~/wwwphpshphpsh -c nonecd ~/www~/projects/phpsh/src/phpshSimple phpsh breakpoints that you can insert into your php code.
jlindamood has suggested adding a very basic debugging facility in which phpsh.php would define some function called like phpsh_breakpoint() which you would be able to put in your code that would cause the php> to re-happen at that breakpoint so that you can investigate whatever state until you issue like a phpsh_resume() (or whatever it would be called).
My suspicion is that that can be done pretty easily be having a new message type from phpsh.php to phpsh.py. (Currently there is only the 'ready' message when phpsh.php is ready to receive a new line of codes from phpsh.py.)
Magic fatal undoing?
Convert from /tmp file to named pipe for 'ready' message passing http://my.opera.com/zomg/blog/2007/08/29/php-and-named-pipes
Maybe phpsh_check_syntax shouldn't actually be installed as a script, and just be a pkg_resource? Didn't want to worry about zip file overhead, and installing didn't seem like a big deal.
Similarly, php_manual.db should probably go in share/ not etc/ but similarly was worried about b.s. with setuptools..
Paging for long php> d .. results? Or is terminal scroll fine..
Thread loading ctags and starting php? Would speed start but not restart.
Command-line apc for faster php startup for large codebases.
Note on php start error to start from codebase place?
Make tab to show function signature work with multiline func sigs.
400 followers · starred Nov 2009
302 followers · starred Feb 2014
346 followers · starred May 2009
654 followers · starred May 2009
A read-eval-print-loop for php
See the codeThis is an archived project and is no longer supported or updated by Facebook. Please do not file issues or pull-requests against this repo. If you wish to continue to develop this code yourself, we recommend you fork it.
Proceed and be bold!
phpsh is a read-eval-print-loop for php that features readline history, tab completion, and quick access to documentation. It was developed at Facebook and ironically, is written mostly in python. It is open source and released under a modified BSD license.
Mailing list at: http://groups.google.com/group/phpsh
Version:
Modules:
sudo easy_install pysqlitesudo easy_install readlinepypm install readlineNote that this install currently clobbers any previous /etc/phpsh/rc.php
python setup.py buildsudo python setup.py installphpshNote that this install currently clobbers any previous ~/.phpsh/rc.php
python setup.py install --prefix=~export PYTHONPATH=~/lib/python2.6/site-packages (Adjust this if your python minor version differs from 2.6)~/bin/phpshYou will probably want to put the PYTHONPATH line in your .bashrc or such, and just add ~/bin to your PATH as well.
There are more details on installing from a setup.py at http://docs.python.org/library/distutils.html
phpsh and have fun.cd ~/wwwctags -R # for phpsh ctags integration, recommendedphpsh lib/init.php # or some file(s) that load codebase librariescd ~/wwwphpshphpsh -c nonecd ~/www~/projects/phpsh/src/phpshSimple phpsh breakpoints that you can insert into your php code.
jlindamood has suggested adding a very basic debugging facility in which phpsh.php would define some function called like phpsh_breakpoint() which you would be able to put in your code that would cause the php> to re-happen at that breakpoint so that you can investigate whatever state until you issue like a phpsh_resume() (or whatever it would be called).
My suspicion is that that can be done pretty easily be having a new message type from phpsh.php to phpsh.py. (Currently there is only the 'ready' message when phpsh.php is ready to receive a new line of codes from phpsh.py.)
Magic fatal undoing?
Convert from /tmp file to named pipe for 'ready' message passing http://my.opera.com/zomg/blog/2007/08/29/php-and-named-pipes
Maybe phpsh_check_syntax shouldn't actually be installed as a script, and just be a pkg_resource? Didn't want to worry about zip file overhead, and installing didn't seem like a big deal.
Similarly, php_manual.db should probably go in share/ not etc/ but similarly was worried about b.s. with setuptools..
Paging for long php> d .. results? Or is terminal scroll fine..
Thread loading ctags and starting php? Would speed start but not restart.
Command-line apc for faster php startup for large codebases.
Note on php start error to start from codebase place?
Make tab to show function signature work with multiline func sigs.
400 followers · starred Nov 2009
302 followers · starred Feb 2014
346 followers · starred May 2009
654 followers · starred May 2009