lighttpd forum php-shell > Interactive Shell for PHP

Posted by Jan Kneschke
on 08.05.2006 12:16
Over the weekend I've written a interactive shell for PHP. If you know 
iruby or ipython: this is intended to provide the same for PHP.

http://jan.kneschke.de/projects/php-shell/

Feel free to add comments and wishes to this forum.

Jan
Posted by Pedro Palazón (Guest)
on 11.05.2006 13:30
Nice initiative. It looks very promising, specially for projects where 
some kind of command line with preloaded libraries is needed.

> Feel free to add comments and wishes to this forum.


Arrays?.

>> $v = array('one','two');
359 (T_ARRAY): array
Function () doesn't exist
Posted by Jan Kneschke
on 14.05.2006 23:10
Pedro Palazón wrote:
> Arrays?.
> 
>>> $v = array('one','two');
> 359 (T_ARRAY): array
> Function () doesn't exist

Fixed in 0.2.0:

>> $v = array('one','two');
array (
  0 => 'one',
  1 => 'two',
)

http://jan.kneschke.de/projects/php-shell/

has the updated package, now as PEAR package for a simpler installation.

Jan
Posted by Pedro Palazón
on 15.05.2006 09:58
Jan Kneschke wrote:

> has the updated package, now as PEAR package for a simpler installation.

Just in case you've got the default white shell for ubuntu and so on, 
here is a way to customize colours - yellow doesn't looks too nice over 
white background ;-):

# shell colours
define("C_RED","\033[0;31m");
define("C_GREEN","\033[0;32m");
define("C_LIGHT_GRAY","\033[0;37m");
define("C_RESET","\033[0m");

define("C_BROWN","\033[0;33m");
define("C_BLUE","\033[0;34m");
define("C_PURPLE","\033[0;35m");
define("C_CYAN","\033[0;36m");
define("C_GRAY","\033[1;30m");
define("C_WHITE","\033[1;37m");
define("C_YELLOW","\033[1;33m");

define("C_LIGHT_BLUE","\033[1;34m");
define("C_LIGHT_CYAN","\033[1;36m");
define("C_LIGHT_PURPLE","\033[1;35m");
define("C_LIGHT_RED","\033[1;31m");
define("C_LIGHT_GREEN","\033[1;32m");

# customize colours here:
define("SHELL_DEFAULT_COLOUR",C_YELLOW);
define("SHELL_VAL_COLOUR",C_WHITE);
define("SHELL_EXCEPTION_COLOUR",C_PURPLE);

And at the end of PHP_Shell.php use the last three defined constants.

Nice work, Jan!
Posted by Jan Kneschke
on 15.05.2006 14:12
Pedro Palazón wrote:
> Jan Kneschke wrote:
> 
>> has the updated package, now as PEAR package for a simpler installation.
> 
> Just in case you've got the default white shell for ubuntu and so on, 
> here is a way to customize colours - yellow doesn't looks too nice over 
> white background ;-):

Right :) I use a dark background and didn't noticed that.

> # customize colours here:
> define("SHELL_DEFAULT_COLOUR",C_YELLOW);
> define("SHELL_VAL_COLOUR",C_WHITE);
> define("SHELL_EXCEPTION_COLOUR",C_PURPLE);
> 
> And at the end of PHP_Shell.php use the last three defined constants.

I made the C_* constants class constants of PHP_Shell and set the
default colour if they aren't externally defined. That will be part of 
the next release.

> Nice work, Jan!

Jan