Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Psysh Laravel Package

psy/psysh

PsySH is an interactive PHP REPL and runtime developer console for debugging and exploring code. Inspect variables, run snippets, and get contextual help in a powerful shell, with configuration, themes, and integrations available.

View on GitHub
Deep Wiki
Context7
v0.12.22

Runtime config and clipboard support

PsySH has a new config command for inspecting and updating runtime-configurable settings during the current session. You can tweak things like pager, theme, verbosity, useSuggestions, useSyntaxHighlighting, clipboardCommand, and semicolonsSuppressReturn without restarting the shell. Fixes #361

There’s also a new copy command for copying the last result ($_) or any expression to your clipboard. Works with system clipboard commands, or via OSC 52 for SSH and remote terminals.

Configure with clipboardCommand or useOsc52Clipboard in your config.

Semicolon-based return suppression

Optionally suppress return values by ending a statement with ;, similar to MATLAB/Octave behavior. Supports a 'double' mode requiring ;; for suppression (if requireSemicolons is also enabled, both true and 'double' require ;;).

'semicolonsSuppressReturn' => true,
'semicolonsSuppressReturn' => 'double', // Always require ;; to suppress

Output and exception display improvements

Strings are now valid PHP!

  • PsySH now preserves backslashes and other characters it previously mangled in a few cases. Fixes #351, #568
  • Multiline strings are rendered using heredoc-style output rather than triple-quoted strings """. The old format is available via useDeprecatedMultilineStrings until the next major release.

Providing an exceptionDetails callback via config renders additional context about exceptions (e.g. validation errors) alongside the error message. Fixes #648

A few other improvements:

  • More consistent compact (and non-compact) output spacing.
  • Responsive help layout adapts to terminal width.

Better completion for everyone

Legacy readline now shares PsySH’s newer completion engine, which brings much better parity between ext-readline/libedit and experimental interactive readline. Command argument completion, better multiline buffering, and a handful of command-dispatch edge cases now work much more consistently outside experimental readline too.

Commands can now define their own argument completions via CommandArgumentCompletionAware.

Interactive readline polish

New in the experimental interactive readline:

  • Live syntax highlighting — code is highlighted as you type. Can be disabled via useSyntaxHighlighting if you don't like colors, I guess.
  • Allman-style indenting — opening brackets on a new line get proper indentation.
  • Improved auto-dedent — closing brackets automatically reduce indentation.

psy\info() and --info also report more detail about readline and autocomplete state.

Run psysh with --experimental-readline and try it out. It's getting kind of awesome!

Compatibility note

Bare config and copy at the prompt now resolve to PsySH commands before PHP function calls. Prefix ambiguous input with ; to force PHP execution.

Bug fixes

  • Use aliases are now tracked by import type (class vs function vs constant), fixing resolution bugs with use function and use const statements.
  • Fix pager pipe warnings when user quits pager early
  • Fix eval error messages incorrectly suppressing PsySH file paths
  • Improve terminal width check on oldest supported Symfony versions
  • Fix a code cleaner bug with throw new Exception in PHP 7.4

Improvements

  • Added --pager / --no-pager CLI options
  • Richer psy\info() / --info output with interactive completion
  • Added hermetic test bootstrap, PTY smoketests, and additional downstream/composer-repl coverage
  • Ctrl-C now interrupts the edit command instead of waiting for the editor to close
v0.12.21

Added an experimental interactive readline: a from-scratch pure-PHP readline replacement built specifically for PsySH. Instead of delegating to ext-readline or ext-libedit, this gives PsySH full control over input, editing, completion, and rendering.

This is opt-in and experimental. Default behavior is completely unchanged. Enable it in your config or from the command line:

'useExperimentalReadline' => true,
psysh --experimental-readline

See the interactive readline wiki page for more!

Completions that actually understand your code

The new completion engine is syntax-aware, type-aware, and runtime-value-aware. It parses your input, resolves types from live objects in scope, and completes based on what your code actually is, not just string matching on symbol names.

Type $user-> and see that object's actual methods and properties. Chain through $repo->find(1)-> and get completions for the return type. Fuzzy matching means asum finds array_sum and stl finds strtolower. Completions show in a navigable multi-column menu.

Multi-line editing

Press Enter on an incomplete statement and the input continues on the next line with proper indentation. Closing brackets auto-dedent. Shift+Enter always inserts a newline. No more fighting the shell to write a multi-line closure.

History

  • Reverse history search (Ctrl+R) with an overlay showing match highlighting, smart-case filtering, deduplication, and keyboard navigation.
  • Filtered history navigation: type part of a previous command, then press Up/Down to cycle through matching history entries.

And more

  • Fish-style inline autosuggestions from your history. This one's still a bit rough; enable it separately with 'useSuggestions' => true.
  • Bracket and quote auto-pairing with smart backspace.
  • Bracketed paste mode: pastes multi-line code verbatim without executing line-by-line.
  • No ext-readline or ext-libedit required. Works with any terminal.
  • Ctrl+L to clear the screen.

This addresses a bunch of long-standing issues: #234, #254, #309, #346, #506, #561, #668, #732, #769, #869.

We'd love your feedback! Give it a try, and let us know what works and what doesn't. The goal is to make this the default. Help us get it there. 🧪

v0.12.20

Project trust edge case fixes

Fixed several edge cases with the Restricted Mode introduced in v0.12.19 where non-interactive contexts (piped input, execute() calls, Composer proxy scripts) could incorrectly trigger trust prompts or restrict trusted functionality.

Fixes #913

Commands work better outside the shell

Decoupled commands from ShellOutput via a new ShellOutputAdapter, so commands degrade gracefully when used in non-interactive contexts rather than failing on missing shell features.

Improvements

  • Added downstream compatibility tests for local and CI workflows
  • Moved internal helper scripts from bin/ to scripts/
v0.12.19

⚠️ Security fix

Fixed a CWD configuration poisoning vulnerability (CVE-2026-25129) where a malicious .psysh.php file in an attacker-writable directory could execute arbitrary code when a victim runs PsySH from that directory. This affects all versions prior to v0.12.19 and v0.11.23, including downstream consumers like Laravel Tinker, when invoked from an attacker-writable CWD.

Fixed in v0.12.19 and v0.11.23. Upgrade ASAP.

Restricted Mode

PsySH now requires explicit trust before loading project-local config (.psysh.php), local PsySH binaries, or Composer autoloads from untrusted projects. Trust decisions are persisted per-project in trusted_projects.json.

Configure with trustProject:

'trustProject' => 'prompt',  // default — ask interactively
'trustProject' => 'always',  // trust all projects
'trustProject' => 'never',   // always run restricted

Or use --trust-project / --no-trust-project CLI flags, or the PSYSH_TRUST_PROJECT env var.

Non-interactive sessions automatically skip untrusted features with a warning.

Magic method and property support 🪄

Tab completion, ls, doc, and show commands now recognize [@method](https://github.com/method) and [@property](https://github.com/property) docblock tags. Magic members display in magenta so you can tell them apart from real methods and properties.

Inheritance works as expected — magic members from parent classes, interfaces, and traits are included, with child declarations taking precedence.

Also fixes parsing of generic types (e.g., array<int, string>) in docblock tags, which previously broke on whitespace inside angle brackets.

See #905

Improvements

  • Excluded a few unnecessary files and folders from release source zips (Thanks @reedy!)
  • Fixed --cwd to actually change the working directory. Previously it only affected discovery for autoload/config, so relative paths and other directory-dependent behavior didn’t work as expected inside the shell.
  • Significantly improved memory usage with older php-parser versions (pre-v4.18.0)
v0.11.23
  • Fixed CWD configuration poisoning vulnerability (CVE-2026-25129). Backported Restricted Mode from v0.12. PsySH now requires explicit trust before loading local config (.psysh.php), local PsySH binaries, or Composer autoloads from untrusted projects. Configure with trustProject config option, --trust-project / --no-trust-project CLI flags, or PSYSH_TRUST_PROJECT env var.
v0.12.18
  • Fix exit() not working when uopz extension is loaded
  • Don't reopen pager if user closes it early
  • Ensure stty state is restored before exiting PsySH (fixes an issue where Ctrl-C might be incorrectly handled after exiting)
v0.12.17

Hot code reloading!!?!?1?

Install the uopz extension (5.0+) and PsySH will automatically reload modified files during your session. Edit code, switch back to PsySH, and your changes are live—no restart needed!

What gets reloaded

  • Method bodies (including private/protected)
  • Function implementations (and new functions!)
  • Class and global constants

What can't be reloaded

  • New class methods
  • Class properties, inheritance, or interfaces
  • Method signatures

PsySH skips "risky" reloads by default (conditional definitions, static variables). Use the new yolo command to bypass safety checks:

>>> my_helper()
Warning: Skipped conditional: if (...) { function my_helper() ... }

>>> yolo !!
=> "result"

See the documentation for more details.

Bug fixes

  • Fix "array offset on null" warning on Ctrl-C — plays nicer with Laravel + PHP 8.5
  • Work around O(n²) performance in Symfony OutputFormatter
v0.12.16

A quick release adding support for Symfony Console v7.4+ and v8.x.

v0.12.15

Abbreviated output reverted

The abbreviated return value output introduced in v0.12.13 has been reverted. This feature attempted to show shorter output for statements that looked like they were trying to take an action (like assignments and method calls with side effects) while preserving full output for inspection-like statements. Unfortunately, this version of the feature just ... wasn't it.

Thanks to everyone who provided feedback. If you've got thoughts on approaches that could make this better, please share them in #512!

In-shell manual updates

You can now update the PHP manual directly from inside the shell! Run doc --update-manual to fetch the latest manual version.

More robust manual handling

  • Log a warning (and continue) when trying to read from an invalid manual file
  • Show invalid manual info in --info and \Psy\info()
  • Prompt to clean up invalid manual files when running --update-manual
  • Prompt to upgrade to v3 manual (preserving language selection!) when running --update-manual with an existing sqlite manual
  • Preserve legacy manuals when updating to v3, supporting systems with multiple PsySH versions installed

Bug fixes

  • Fix namespace and use statement edge cases where aliases weren't properly tracked across REPL inputs
  • Fix history command filtering and --head/--tail interaction to apply filters first
  • Fix E_STRICT warning in PHP 8.4
  • Fix ParseCommand parsing (you had one job ಠ_ಠ)

Other improvements

  • Add a hint about doc foo when help foo doesn't match a known command
  • Don't call deprecated curl_close() on PHP >= 8.0.0 (thanks @mpesari!)
  • Lock phar build dependencies for reproducible builds
  • Improve PHP 8.5 support
  • Improve test coverage
v0.12.14

Logging support

Log user input, command invocations, and executed code to a PSR-3 logger or callback.

// Simple callback
$config->setLogging(function ($kind, $data) {
    file_put_contents('/tmp/psysh.log', "[$kind] $data\n", FILE_APPEND);
});

// PSR-3 logger with granular control
$config->setLogging([
    'logger' => $psrLogger,
    'level' => [
        'input'   => 'info',
        'command' => false,  // disable
        'execute' => 'debug',
    ],
]);

This has been one of our longest-requested features (🙈) and it fixes #821, #651, and #565.

Huge documentation improvements!

This release adds a new PHP-based manual data format (v3), replacing the previously used sqlite db. The new format:

  • Allows runtime formatting (especially wrapping) rather than pre-rendering at build time.
  • Adds OSC 8 links to php.net!
  • Is smaller, faster, and more flexible than the sqlite format.
  • ... and no longer requires sqlite support to use!

The phar builds now bundle the PHP manual, so these changes work out of the box. There are also automatic update notifications, an an --update-manual command to keep docs current.

If you've already got a manual file installed, remove it then run psysh --update-manual (or psysh --update-manual=LANG) after upgrading!

Fixes #595 and #406.

Other improvements

  • Prettier formatting for --help output
  • Standardized user-facing path pretty printing
v0.12.13

... pushing the limits of what we can plausibly put in a point release.

Autoload warming

Added opt-in autoload warming to improve tab completion and command support. When enabled, PsySH pre-loads classes at startup, making them available to ls, doc, show, and tab completion.

// Enable with defaults (project classes only)
'warmAutoload' => true,

// Advanced configuration
'warmAutoload' => [
    'includeTests' => true,
    'excludeNamespaces' => ['App\Tests\'],
    'includeVendorNamespaces' => ['Symfony\', 'Doctrine\'],
],

Custom warmers can be implemented via AutoloadWarmerInterface. Fixes #650

Implicit use statements

Auto-adds use statements when you reference a class by its short name (and there's exactly one match in configured namespaces).

'implicitUse' => [
    'includeNamespaces' => ['App\'],
    'excludeNamespaces' => ['App\Legacy\'],
],

Works great with autoload warming to make class references feel natural.

Namespace-aware commands

doc, show, and ls commands now resolve class names using the current namespace and use statements, just like code execution does.

SIGINT handling

Hitting ctrl-c during long-running code now interrupts execution and returns to the prompt instead of exiting the shell entirely. Works with or without process forking (requires pcntl and posix support). Fixes #154

Exit status support

PsySH now properly handles exit status codes! Use exit(42) for non-zero status codes or exit('message') to print before exiting. Also exits with non-zero status on unrecoverable errors.

Clickable documentation links

Class names, functions, interfaces, constants, and more in ls, doc, and show commands are now clickable links to php.net (requires Symfony 4.3+, PsySH manual installed, and OSC 8 compatible terminal).

Other improvements

  • Added --info CLI option
  • Added --warm-autoload CLI option
  • Included traits in ClassNamesMatcher tab completion
  • Print shorter return values for actions than inspection
  • Improved PHPStan coverage (levels 2 and 3)
  • More robust smoketests
v0.12.12

Fixing unintentional PHP support version regression due to editor autoformatting :(

Includes the following from v0.12.11:

  • Fix ob_start deprecation in PHP 8.5 (thanks @Ayesh!)
v0.12.11
  • Fix ob_start deprecation in PHP 8.5 (thanks @Ayesh!)
v0.12.10
  • Remove deprecated setAccessible() calls in reflection (Thanks @W0rma!)
  • Update composer urls to https (Thanks @bebehr!)
  • Stop autocompleting function names after -> (Thanks @igorsantos07!)
v0.12.9
  • Stop freaking out if the output pager is closed without writing everything.
  • Prevent deprecation notice when parsing some anonymous classes.
v0.12.8

Improve editor command when using default system runtime dir.

v0.12.7

Resolve type error with the transient readline implementation (Thanks @Fludem!)

v0.12.6

Tighten up a bunch of internal types and defaults.

This should have absolutely no impact on your day to day life, but it makes things nicer for me :)

v0.12.5

New:

  • Automatically show --help output for some command input exceptions (for example, if you're missing an argument, instead of just complaining, show the command usage)
  • Pass readline_info() to tab completion matchers' getMatches methods, allowing more complex matching logic (Thanks @tareqas!)

Improved:

  • Improve variadic placeholder param support (Thanks @sebdesign!)
  • Deal with PHP 8.4 E_STRICT deprecation (Thanks @Ayesh!)
  • Work around scoping issues with PHP-Parser backwards compatibility shims.
  • Play nicer with systems where less is not a symlink, and where PHP error suppression is ignored ... or over-eargly turned into exceptions (Thanks @piurafunk!)
  • Handle unavailable config paths more gracefully (Thanks @apreiml!)
  • Handle missing or non-writable runtime directory more gracefully.
  • Remove outdated alias from help show output.
v0.12.4
  • Improve support for named args (Thanks @HypeMC!)
  • Improve return type name support, especially with newer PHP-Parser (Thanks @AegirLeet! Twice!)
  • Minor code cleanup.
  • Work around php-scoper class alias namespacing issue.
v0.12.3
  • Fix non-namespaced class support in doc, show, and ls commands.
v0.12.2
  • Fix broken output paging in Alpine-flavored Docker containers (Thanks @iwex!)
v0.12.1
  • Fix deprecated getVersion call (Thanks @Firehed!)
  • Fix deprecated implicitly nullable param types (Thanks @Ayesh!)
  • Bump github actions library versions, minor cleanup.
  • Fix Composer lockfile added to release assets (🤞)
v0.12.0

It's that time of year. Let's ship a major version of PsySH!

New:

  • Drop support for PHP versions earlier than 7.4.
  • Drop support for PHP-Parser versions earlier than 4.x.
  • Remove PHP 7.0 compatibility build. For the first time in a long time, there's only one pre-built Phar!
  • Include a composer lockfile in the release assets. Note that future releases will include a Composer lockfile. This one didn't because I messed up a path. Sorry 😞

And improved:

  • Add support for Symfony 7 types, future-proof future Symfony deprecations.
  • Add forward-compatibility for upcoming PHP-Parser 5.x.
  • Clean up a bunch of deprecated code, polyfills for older PHP versions, etc.
  • Remove suggested readline extension dependency; the userland implementation is a sufficient fallback!
  • Improve representation of nullable types, type unions, and return types in function signatures.

PsySH v0.12.0 drops support for PHP versions older than 7.4.

Upgrade already 🙂

v0.11.22
  • Fix Sudo static property manipulation in PHP 8.3.
v0.11.21

Made a bunch of behind the scenes fixes, that you probably won't even notice. Specifically:

  • Ensure that parse errors show the original message, not "unexpected EOF" (unless that was the original error).
  • Prettier output for Symfony Console exceptions.
  • Improve argument parsing for timeit command.
  • Remove very deprecated Symfony TableHelper fallback (it's been unsupported by our oldest supported Console version for years).
  • A bunch of static analysis improvements.
v0.11.20
  • Fix undefined array key (when argv doesn't exist) in userland readline implementation (Thanks @BafS!)
v0.11.19

New:

  • Add strictTypes config option to enforce strict types by default.
v0.11.18
  • Fix environment variable lookup when running from the cli-server SAPI (Thanks @supriyo-biswas!)
v0.11.17
  • Use high resolution timing for timeit command.
  • Clean up a few edge cases where formatting markup shows up in output.
v0.11.16
  • Fix a few edge cases around array assignment.
v0.11.15
  • Bypass visibility restrictions when using reflecting commands (dump, doc, show, list).
  • Highlight code comments in grey, if availble.
  • Support more cases of (valid but weird) empty array dim fetch.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport