Weave 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 Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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:

  1. You maintain a Symfony app in the same monorepo/company.
  2. You are porting logic between Symfony and Laravel and want a comparable REPL to reason about services.
  3. You need PsySH outside both frameworks and are looking at how a framework integrates it.

Minimal steps (Symfony side):

composer require --dev theofidry/psysh-bundle

Register the bundle:

  • Symfony 3/4 (legacy AppKernel): add new PsyshBundle\PsyshBundle() to registerBundles().
  • Symfony 4+/Flex: add to config/bundles.php.

Then:

bin/console psysh

Where to look first:

  • bin/console psysh --help — exposes --config, and startup options.
  • The bundle's DependencyInjection/Configuration.php source for the psysh: config tree (this is the authoritative list, docs are thin).
  • For Laravel people: 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

Implementation Patterns

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.

Gotchas and Tips

  • It is archived and unmaintained. Last release 2021-12-29. Expect no Symfony 6/7 or PHP 8.2+ fixes. Pin versions and treat it as frozen; do not build new automation on it. The 2.04 score and 0 dependents reflect this.
  • Wrong framework. 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.
  • You already have this in Laravel. laravel/tinker (psy/psysh) is included by default. Adding this bundle is redundant at best.
  • Network calls on boot. PsySH's update checker phones home on startup; in restricted or air-gapped environments this stalls the REPL. Disable it (updateCheck: never style config, or via your .psysh.php).
  • Config file location quirks. PsySH looks for .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.
  • Kernel boot failures surface as REPL crashes. If 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.
  • Extension points are the reason to keep it. If you are stuck maintaining a Symfony app on this bundle, centralize custom casters/commands in bundle config rather than ad-hoc .psysh.php files, so every developer gets the same REPL. That is the pattern worth porting conceptually to config/tinker.php on Laravel.
  • Migration path. For Symfony teams, the modern approach is to run PsySH directly (vendor/bin/psysh) or use the maintained symfony/maker/var-dumper tooling. For Laravel teams, standardize on Tinker config and skip this bundle entirely.
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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core