PsySH CLI
PsySH evaluates PHP interactively, inspects variables, code and documentation, and opens debug breakpoints inside CLI scripts.
- 9,830 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- Entered PHP executes in the process context and can trigger actions using application credentials.
Install
Manual install
Use the primary installation wiki. Prepare a test context, inspect variables and source first and agree separately on method execution.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- Entered PHP executes in the process context and can trigger actions using application credentials.
This is third-party code. Review the repository files before installing.
What it does
Enter an expression and immediately see PHP’s result. PsySH inspects variables and methods and opens object source or function documentation, supporting small experiments without restarting the whole program. It can also be embedded at a CLI-script breakpoint. Execution pauses and the current state becomes available. Method calls use the actual process objects and dependencies, making a test context essential for experiments rather than live credentials.
Who it is for. PHP developers investigating objects and CLI-script behavior through an interactive console.
Good fit when
- Compare expected and actual PHP-expression results.
- Inspect a changed object at a CLI-script breakpoint.
- Explore methods and their source while investigating a bug.
- Read function documentation during a console experiment.
Not a fit when
- You need full Xdebug-style stepping.
- You need this debugger through Apache, Nginx or PHP-FPM.
- Arbitrary PHP must not execute with application access.
Example request
Propose inspecting an object in a test CLI script through PsySH without write methods or retained secrets.Limitations
Installation depends on the PHP environment and is covered in the external guide; choose the matching option first. The console pauses in context but does not replace a step-through debugger. Debugging through ordinary web servers and PHP-FPM is unsupported by this mechanism, so verify how the script runs. Method calls use real application dependencies and credentials; work with test data and keep secrets out of retained console history.
How to disable. Exit the console and remove its temporary call from the script. Manage sensitive command-history entries separately.
FAQ
Is PHP merely parsed or executed?
Executed, with the expression result printed immediately.
Does it step through instructions like Xdebug?
No. PsySH pauses at a selected point but does not offer step-through debugging.
How do I find console commands?
Enter `help` to see commands and their purposes.
How do I inspect source?
Use `show` with an object, class or method name. `help show` lists syntax and examples. show reads source without invoking the method.
What does ls display?
`ls` lists variables and object members in PsySH context, not system files.
Discussion
No questions or reviews yet.
Related
CLI toolsThe project-local CLI checks PHP quality, style and complexity so an agent can inspect findings before changing the app.
Methods for an agent in one CLI: comparing options, solving problems and changing code in steps, 20 slash commands in all.
Source search ranks matches using code structure and gives agents relevant snippets without a separate search index.
Nietzschian Debugger is a question-based debugging CLI with per-run model selection; the next invocation has its own setting.
An MCP server for the Node.js debugger: breakpoints, stepping, variable inspection and expression evaluation at a pause
Four experimental Claude Code skills: find twin functions, drive tmux, call MCP from the shell and run Windows 11 in Docker
README in short
The wiki separately covers history, context variables, configuration and integrations, with Windows-specific guidance.