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

An interactive shell for modern PHP.

Frequently asked questions about Psysh
How do I install PsySH in a Laravel project?
Run `composer require psy/psysh` in your project root. Access it via `./vendor/bin/psysh` or integrate it with Laravel’s Artisan by adding an alias in `config/console.php`. For Laravel Tinker compatibility, ensure you’re using PsySH v0.12.0+.
Can PsySH replace Laravel Tinker?
Yes, PsySH is the foundation for Laravel Tinker. Use `./vendor/bin/psysh` for standalone REPL access or `php artisan tinker` for Laravel-specific features like Eloquent model inspection. PsySH offers additional features like hot code reloading (with uopz) and custom themes.
What Laravel versions does PsySH support?
PsySH works with Laravel 5.5+ and PHP 7.2+. For older Laravel versions (5.1–5.4), use PsySH v0.11.x. Check compatibility with your PHP version in the [official docs](https://github.com/bobthecow/psysh/wiki/Installation).
How do I debug Eloquent models or service container bindings in PsySH?
Use Laravel’s `app()` helper to access the container (e.g., `$user = app()->make('App\Models\User')`). Inspect bindings with `app()->bindings()` or dump objects directly (e.g., `dd($user->toArray())`). For Eloquent, leverage magic variables like `$_` for the last evaluated result.
Is PsySH safe for production environments?
PsySH is **not recommended for production**. It exposes runtime code execution risks. Use `trustProject: 'never'` in `.psysh.php` to restrict local config loading. For CI/CD, disable PsySH entirely or sandbox sessions with `--no-config`.
How do I customize PsySH’s appearance or behavior?
Create a `.psysh.php` config file in your project root. Define aliases (e.g., `alias('u', 'app()->make')`), themes, or autoload classes. Refer to the [sample config](https://github.com/bobthecow/psysh/wiki/Sample-config) for syntax. Restart PsySH to apply changes.
What’s the difference between PsySH and PHP’s built-in `php -a`?
PsySH offers **superior introspection** (object traversal, magic variables like `$_`, `$_E`), **history management**, and **Laravel integration** (e.g., `app()` helper). It’s also more stable for long sessions and supports custom themes/commands. `php -a` is a basic REPL with no Laravel-specific features.
Can I use PsySH for testing Laravel logic without writing full tests?
Yes! PsySH is ideal for **exploratory testing**. Load your app’s container (`$app = require __DIR__.'/bootstrap/app.php'`) and interactively test routes, jobs, or Eloquent queries. For repeatable tests, save commands to a `.psysh_history` file or use `psysh --no-history` for one-off checks.
How do I enable hot code reloading in PsySH for rapid iteration?
Install the `uopz` PHP extension (`pecl install uopz`) and enable it in PsySH via `uopz enable`. Use `uopz reload` to reload classes dynamically. Note: This is **experimental** and unsafe for production. Test in staging first and avoid in multi-threaded environments.
What alternatives to PsySH exist for Laravel debugging?
For Laravel, **Laravel Debugbar** (browser-based) and **Xdebug** (IDE integration) are alternatives. For REPLs, consider **PHP’s `php -a`** (basic) or **Symfony’s VarDumper** (for dumps). PsySH stands out for its **interactive shell**, **Laravel-native features**, and **customization** (e.g., themes, aliases).
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai