Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
A interactive PHP Shell
2
=======================
3
 
4
The more I work with other languages like python and ruby I like their way how they
5
work on problems. While PHP is very forgiving on errors, it is weak on the debugging
6
side. It was missing a simple to use interactive shell for years. Python and Ruby have
7
their ipython and iruby shell which give you a direct way to interact with the objects.
8
No need to write a script and execute it afterwards.
9
 
10
 
11
Starting the Shell
12
------------------
13
 
14
Starting with PHP_Shell 0.2.1 starting the shell is done by calling the shell-wrappers:
15
 
16
$ php-shell.sh
17
 
18
or on Windows
19
 
20
> php-shell.bat
21
 
22
Write your own wrapper
23
----------------------
24
 
25
Sometimes you want to write your own shell where you provide your own defaults, colours and
26
error-handlers.
27
 
28
<?php
29
    error_reporting(E_ALL);
30
 
31
    require "php-shell-cmd.php";
32
?>
33
 
34
and execute it with:
35
 
36
$ php -q php-shell.php
37
 
38
Inline Help
39
-----------
40
 
41
PHP-Shell - Version 0.2.0, with readline() support
42
(c) 2006, Jan Kneschke <jan@kneschke.de>
43
released under the terms of the PHP License 2.0
44
 
45
>> use '?' to open the inline help
46
 
47
>> ?
48
"inline help for the PHP-shell
49
 
50
  >> ?
51
    print this help
52
  >> ? <topic>
53
    get the doccomment for a class, method, property or function
54
  >> p <var>
55
    execute a verbose print (if implemented)
56
  >> quit
57
    leave shell
58
"
59
>> ? PHP_Shell
60
 
61
Shell Colours
62
-------------
63
 
64
The shell supports colours to seperate Exceptions from normal output of your
65
functions. To enable the colours you can to set:
66
 
67
>> :set background=dark
68
 
69
By default the colour-schemes 'plain' (the default), 'light' and 'dark' are
70
defined.
71
 
72
You can also register your own colour schemes:
73
 
74
>> $__shell->registerColourScheme( 'custom', array(
75
..   "default" => PHP_SHELL::C_LIGHT_RED, /* colour of the prompt */
76
..   "value" => PHP_SHELL::C_BLACK, /* colour of a return value  */
77
..   "exception" => PHP_SHELL::C_RED, /* colour of a exception  */
78
.. ))
79
 
80
Alternatives
81
------------
82
 
83
- http://david.acz.org/phpa/
84
- http://www.hping.org/phpinteractive/
85
- the embedded interactive php-shell: $ php -a
86