-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
61 lines (40 loc) · 2.21 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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.