PsySH

refs:

PsySH git
PsySH get started

install

composer global require psy/psysh

add .composer/vendor/bin/ to $PATH

install PHP core manual:

mkdir .local/share/psysh
wget http://psysh.org/manual/en/php_manual.sqlite -O .local/share/psysh/php_manual.sqlite

use

show function docs

$ psysh
Psy Shell v0.7.2 (PHP 5.5.9-1ubuntu4.16 — cli) by Justin Hileman
>>> doc strpos
function strpos($haystack, $needle, $offset = unknown)

Description:
  Find the position of the first occurrence of a substring in a string

...

basic commands

>>> help
help       Show a list of commands. Type `help [foo]` for information about [foo]. 
ls         List local, instance or class variables, methods and constants.         
dump       Dump an object or primitive.                                            
doc        Read the documentation for an object, class, constant, method or propert
show       Show the code for an object, class, constant, method or property.       
wtf        Show the backtrace of the most recent exception.                        
whereami   Show where you are in the code.         

...