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, runtime developer console, and debugger. Explore code, inspect variables, and run commands in a powerful shell with history, configuration, themes, and integrations—ideal for fast debugging and experimentation.

View on GitHub
Deep Wiki
Context7

A REPL for PHP

Frequently asked questions about Psysh
How do I install PsySH for Laravel projects?
Use Composer to install PsySH globally (`composer global require psy/psysh`) or locally in your project (`composer require --dev psy/psysh`). For Laravel, you can also integrate it via Artisan by creating a custom command or using `php artisan psysh` if configured. Ensure PHP 8.2+ is installed for full compatibility.
Can PsySH replace Laravel Tinker?
Yes, PsySH is the foundation of Laravel Tinker and offers more features like advanced autocompletion, clipboard support, and custom themes. Replace `php artisan tinker` with `php artisan psysh` for enhanced functionality. PsySH also supports Laravel’s service container natively, making it a drop-in upgrade.
What Laravel versions does PsySH support?
PsySH works with Laravel 8.x, 9.x, and 10.x, as it aligns with PHP 8.2+ support. For older Laravel versions (e.g., 7.x), use PsySH v0.11.x, but note that newer features like experimental readline may not work. Always check the [PsySH manual](https://github.com/bobthecow/psysh/wiki) for version-specific guidance.
How do I securely use PsySH in CI/CD pipelines?
Enable Restricted Mode by setting `'trustProject' => 'never'` in your `.psysh.php` config to block untrusted code execution. Use CLI flags like `--no-pager` for scripting and avoid interactive features. For debugging, manually override trust settings only in trusted environments. Always test security configurations in staging first.
Does PsySH slow down Laravel’s boot time?
PsySH adds minimal overhead during normal Laravel operations, but its syntax-aware autocompletion and runtime reflection can impact boot time if overused. For production, avoid running PsySH during requests. Benchmark in staging by comparing boot times with and without PsySH loaded via `composer.json` scripts or custom Artisan commands.
How can I customize PsySH for Laravel-specific debugging?
Create a `.psysh.php` config file in your project root to customize PsySH. For Laravel, add bindings like `'bindings' => ['app' => fn() => app()]` to access the container directly. Extend PsySH with custom commands using its [command system](https://github.com/bobthecow/psysh/wiki/Commands) to inspect Eloquent models, routes, or queues (e.g., `route:list`).
What are the alternatives to PsySH for Laravel debugging?
Laravel Tinker (built-in) is the simplest alternative, but PsySH offers superior features like clipboard integration, better autocompletion, and themes. For lightweight debugging, PHP’s native `php -a` works but lacks Laravel-specific tools. For advanced use cases, PsySH’s modularity and integrations make it the best choice.
How do I enable clipboard support in PsySH for Laravel?
Configure clipboard support in `.psysh.php` by setting `'clipboardCommand' => 'pbcopy'` (macOS), `'clipboardCommand' => 'xclip -selection clipboard'` (Linux), or `'clipboardCommand' => 'clip'` (Windows). Ensure the command-line tool is installed. This allows copying/pasting variables or output directly from PsySH, improving workflow efficiency.
Can PsySH be used for production debugging?
PsySH is primarily a development tool and should not run in production. However, you can use it in staging or production-like environments for debugging by enabling Restricted Mode (`'trustProject' => 'never'`) and running it via CLI scripts. Avoid interactive sessions in production to prevent security risks or performance impacts.
How do I troubleshoot PsySH issues in Laravel?
Start by checking PHP extensions (`ext-readline` or `ext-libedit` for traditional readline). If issues persist, disable experimental features in `.psysh.php` (e.g., `'useExperimentalReadline' => false`). For Laravel-specific problems, verify service container bindings and clear cached configs (`php artisan config:clear`). Refer to the [Troubleshooting guide](https://github.com/bobthecow/psysh/wiki/Troubleshooting) for common fixes.
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony