theofidry/psysh-bundle
A Symfony bundle that integrates PsySH, bringing an interactive PHP REPL and debugger to your console. Inspect variables, experiment with code, and debug applications without leaving your terminal. Easy to install and configure.
First, the important context: theofidry/psysh-bundle is a Symfony bundle, not a Laravel package. It registers PsySH as a Symfony console command (bin/console psysh) so you get a REPL wired to the booted Symfony kernel. Laravel already ships laravel/tinker, which is itself a thin wrapper around psy/psysh. For day-to-day Laravel work you will almost never install this — the equivalent is already in your composer.json. The realistic scenarios where you touch this package are:
Minimal steps (Symfony side):
composer require --dev theofidry/psysh-bundle
Register the bundle:
AppKernel): add new PsyshBundle\PsyshBundle() to registerBundles().config/bundles.php.Then:
bin/console psysh
Where to look first:
bin/console psysh --help — exposes --config, and startup options.DependencyInjection/Configuration.php source for the psysh: config tree (this is the authoritative list, docs are thin).vendor/laravel/tinker and config/tinker.php — that is your "equivalent package."First use case (whichever framework, same idea): boot the app, then introspect live objects without editing code:
$container->get('some.service'); // Symfony
app('some.service'); // Laravel Tinker
Kernel-aware introspection (the actual value of the bundle). The REPL boots the Symfony kernel, so $container, $kernel, and any service you can name are live. This is the daily-use pattern: resolve a service, poke at it, reproduce a bug, exit. The Laravel analogue is resolving from app() in Tinker.
Configuration via the bundle config tree. Rather than a .psysh.php scattered in the project root, configure through config/packages/psysh.yml (or config.yml for older Symfony):
psysh: ~
# typical knobs you'll find in Configuration.php:
# configFile: point at a custom .psysh.php
# startupMessage: banner shown on boot
# updateCheck: "never" to stop the network call
Custom casters / commands. PsySH's extension points (custom casters, custom commands) can be registered so they are loaded on every bin/console psysh invocation — this is where the bundle earns its keep over calling vendor/bin/psysh bare, because casters can be made container-aware. In Laravel, register casters through tinker.php's commands/alias arrays or a config/psysh.php if you wire psy/psysh yourself.
Debugging workflow. Use the REPL to reproduce a failing service call by hand: fetch the service, call the method that blew up, inspect the exception and the object graph. This is faster than adding dump() + re-request, and it mirrors what php artisan tinker gives you in Laravel.
CI / production safety. Install --dev only. The REPL is an interactive tool; it should never be present in a production build. If you are auditing a Symfony app, confirm the bundle is in require-dev, not require.
Laravel-native equivalents to reach for instead:
php artisan tinker
# or, for a bare PsySH without the framework, install psy/psysh directly:
composer require --dev psy/psysh
vendor/bin/psysh
Customize Tinker in config/tinker.php (aliases, dont_alias, commands). That is the "implementation pattern" a Laravel developer should internalize — the Symfony bundle is not the tool here.
composer require theofidry/psysh-bundle in a Laravel app will not register a service provider and will not give you an Artisan command. Laravel's container/service-provider model is incompatible with Symfony bundle registration. Don't confuse the two.laravel/tinker (psy/psysh) is included by default. Adding this bundle is redundant at best.updateCheck: never style config, or via your .psysh.php)..psysh.php in the current working directory; the bundle lets you point at a specific file. If your casters aren't loading, verify which config file is actually being read — a stray .psysh.php in $HOME or the project root will shadow expectations.bin/console psysh dies immediately, the underlying Symfony kernel failed to boot (bad env var, cache warm-up issue). Reproduce with any other bin/console command first to isolate whether it's PsySH or the app..psysh.php files, so every developer gets the same REPL. That is the pattern worth porting conceptually to config/tinker.php on Laravel.vendor/bin/psysh) or use the maintained symfony/maker/var-dumper tooling. For Laravel teams, standardize on Tinker config and skip this bundle entirely.How can I help you explore Laravel packages today?