PsySH Documentation
repository·main·Indexed 27 days ago
https://github.com/bobthecow/psyshPsySH is a runtime developer console, interactive debugger, and REPL (Read–Eval–Print Loop) for PHP. It provides an interactive environment for executing code, inspecting variables, and debugging applications. Key features include a runtime configuration system via the `config` command, a `doc` command for reading PHP manual and docblock documentation, an `edit` command for external editor integration, and advanced inspection tools like `dump` and `ls`.
What's inside PsySH
- PsySH is a runtime developer console, interactive debugger, and REPL (Read–Eval–Print Loop) for PHP. It provides an interactive environment for exploring and debugging PHP code.
Configure PsySH project trust via environment variables
mainYou can control whether PsySH trusts local project autoloader files by setting the
PSYSH_TRUST_PROJECTenvironment variable. This is particularly useful in automated environments or CI/CD pipelines.Supported values:
trueor1: Trust the project.falseor0: Do not trust the project.
Examples of using `config get`
mainThe following examples demonstrate how to retrieve common PsySH configuration settings using the
config getcommand:To check the current verbosity level:
config get verbosityTo check the current theme:
config get theme
config get verbosity config get themeParse code strings using CodeArgumentParser
mainThe
CodeArgumentParserclass is used to lex and parse a string of PHP code into a list of statements. It is designed for processing code arguments provided via CLI.When using
parse(), you should provide the raw PHP code string without a<?phpopening tag. The class automatically prepends the tag and attempts to handle common syntax issues like missing trailing semicolons by retrying the parse with a semicolon appended if an 'unexpected EOF' error is encountered.Reference: `doc` command flags and arguments
mainThe
doccommand definition includes the following inputs:Type Name Alias Description Option all-aShow documentation for superclasses as well as the current class. Option update-manual(none) Download and install the latest PHP manual (optional language code). Argument target(none) Function, class, instance, constant, method or property to document. Reference: Runtime-configurable PsySH keys
mainThe following keys are available for inspection or modification via the
configcommand:verbosity useUnicode errorLoggingLevel clipboardCommand useOsc52Clipboard colorMode theme pager requireSemicolons semicolonsSuppressReturn useBracketedPaste useSyntaxHighlighting useSuggestionsConfigure the editor for the `edit` command
mainThe
editcommand relies on theEDITORenvironment variable to determine which external program to launch. To change the editor used by PsySH, set this variable in your shell environment.If the
EDITORvariable is unset, PsySH will attempt to usenanoby default.Reference: PsySH CLI flags
mainThe following flags are available when invoking thepsyshbinary:Reference the `buffer` command options
mainThebuffercommand supports the following options:Reference the `wtf` command options and arguments
mainThewtfcommand (aliases:last-exception,wtf?) accepts the following arguments and options:Reference the throw-up command arguments
mainThethrow-upcommand accepts a single optional argument used to define what should be thrown.Reference: `show` command arguments and options
mainThe following are the arguments and options available for the
showcommand:Type Name Required Description Argument targetNo Function, class, instance, constant, method or property to show. Option --exNo Show last exception context. Optionally specify a stack index. (Default: 1)