Skip to content

matt2000/phprepl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP-REPL

A simple REPL/Shell for PHP written in PHP.

==Description==

Developed & tested with PHP 5.3 under Linux.

Works best with BASH and rlwrap.

Advantages over other PHP REPLs:
- Written in PHP, so no other requirements to run it, and no other skills needed to hack it.
- Doesn't require PHP to be compiled with readline
- Works with everything your PHP supports, e.g., auto-loaded classes.

Inspired by http://www.php.net/manual/en/features.commandline.interactive.php#98642

See also: http://drupal.org/node/600556

==Installation==

Not required, but if you're running under BASH, you can run `sudo ./install.sh` to install globally for all users.

==Usage==
If you have BASH, just run `phprepl` for the fully featured version.

Otherwise, you can run `php /path/to/phprepl.php`.

Tips:
- The semi-colon is optional for one-line commands.
- You can run a function that doesn't require arguments with just the function name, e.g. 'phpinfo'.
- Tab completion of previously used commands is available if you have rlwrap.
- Just type $var to get print_r($var)
- The last output variable/return is available as $out. So don't use that variable name yourself in the global scope if you value your sanity.
- Input code is not validated. It's really easy to crash this shell.
- Type CTRL-c to quit.


===Drupal Users===
If you have Drush, you can run `drepl` from a Drupal directory to get a PHP REPL with Drupal fully bootstrapped for you.

Or if installed in a drush commands directory, you can run `drush repl`. (History and Tab Completion not yet implemented via this command.)


==License==

PHP-REPL
Copyright (C) 2012  Matt Chapman

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

About

A REPL for PHP in PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages