Skip to main content
PsySH provides a rich set of commands for exploring code, debugging, and managing your REPL session. All commands can be invoked with their name or any of their aliases.

Documentation & Exploration

doc

Read documentation for functions, classes, methods, and properties

show

Display source code for classes, methods, and functions

ls

List variables, methods, properties, and constants

dump

Dump objects and primitives with detailed formatting

Debugging

wtf

Show the backtrace of the most recent exception

trace

Display the current call stack

whereami

Show where you are in the code

show --ex

Show exception context with source code

History & Editing

history

Search, save, and replay command history

edit

Open an external editor for code input

Session Management

help

Display help for commands

clear

Clear the screen

exit

Exit the REPL session

Quick Command Reference

CommandAliasesDescription
docrtfm, manRead documentation for code elements
show-Show source code or exception context
lsdirList variables, methods, properties
dump-Dump an object or primitive
wtflast-exception, wtf?Show exception backtrace
trace-Show current call stack
whereami-Show current code location
historyhistManage command history
edit-Open external editor
help?Show command help
clear-Clear the screen
exitquit, qExit PsySH

Common Patterns

Exploring a Class

>>> $obj = new DateTime()
>>> ls $obj                    // List all properties and methods
>>> doc $obj->format           // Read method documentation
>>> show DateTime::createFromFormat  // View source code

Debugging an Exception

>>> someFunction()  // Throws exception
>>> wtf             // Show basic backtrace
>>> wtf ????        // Show more trace lines
>>> wtf -a          // Show entire backtrace
>>> show --ex       // Show exception context with code
>>> show --ex 3     // Show specific trace level

Working with History

>>> history                          // Show all history
>>> history --grep "/DateTime/"      // Search history
>>> history --tail 20                // Show last 20 commands
>>> history --show 5..10 --replay    // Replay commands 5-10

Getting Help

For detailed help on any command:
>>> help <command>
>>> help doc
>>> help ls
Most commands support tab completion for arguments. Press Tab to see available options!

Build docs developers (and LLMs) love