What is PsySH?
PsySH provides a powerful interactive shell for PHP that allows you to:- Execute PHP code interactively and see results immediately
- Debug your application at runtime by dropping into a shell
- Inspect variables, objects, and application state
- Explore classes, methods, and functions with built-in documentation
- Test code snippets without creating temporary files
Installation
Get PsySH installed on your system via Composer, PHAR, or global install
Quick Start
Start using PsySH in minutes with practical examples
Commands
Explore built-in commands for inspecting code and managing your session
Configuration
Customize PsySH with themes, history settings, and more
Key Features
Interactive REPL
Run PHP code interactively and see results immediately:Runtime Debugging
Drop into a debug shell anywhere in your code:Code Introspection
Explore your code with built-in commands:PHP Manual Integration
Access PHP documentation right from the shell:Why PsySH?
PsySH is built on top of Symfony Console and nikic/php-parser, providing a robust and reliable development tool.
- No setup required: Just install and start using it immediately
- Framework integration: Works seamlessly with Laravel, Symfony, Drupal, and more
- Powerful debugging: Set breakpoints with a single function call
- Tab completion: Smart autocomplete for classes, functions, and variables
- History management: Your command history is saved between sessions
Use Cases
Quick Experimentation
Test PHP features or library functions without creating test files:Application Debugging
Inspect application state during runtime:Learning and Teaching
Perfect for learning PHP or teaching concepts interactively:Requirements
PsySH requires:- PHP 7.4 or higher (PHP 8.0+ recommended)
- The
jsonextension (usually enabled by default) - The
tokenizerextension (usually enabled by default)
Next Steps
Install PsySH
Follow the installation guide to get PsySH set up on your system.
Try the Quick Start
Work through the quick start guide to learn the basics.
Explore Commands
Check out the commands reference to discover what PsySH can do.