PHPackages                             xman12/psysh-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. xman12/psysh-bundle

ActiveSymfony-bundle[CLI &amp; Console](/categories/cli)

xman12/psysh-bundle
===================

A port of the PHP REPL PsySH for Symfony.

1.0.3(1mo ago)02↓100%MITPHPPHP &gt;=8.1

Since Apr 6Pushed 1mo agoCompare

[ Source](https://github.com/xman12/PsyshBundle)[ Packagist](https://packagist.org/packages/xman12/psysh-bundle)[ GitHub Sponsors](https://github.com/theofidry)[ RSS](/packages/xman12-psysh-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (4)Used By (0)

PsyshBundle
===========

[](#psyshbundle)

[![Package version](https://camo.githubusercontent.com/cdca6a98afe73ec6a41538c35c76414dae0800164bc5bcf6d026f6e1d29b2523/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468656f66696472792f70737973682d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/theofidry/psysh-bundle)[![Build Status](https://camo.githubusercontent.com/26cd090ea14318ad64870bee998ae1c76abc38fa571510893e159efdc9abc666/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7468656f66696472792f507379736842756e646c652f74657374732e79616d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/theofidry/PsyshBundle/actions)[![License](https://camo.githubusercontent.com/10e85a5778fe7601504a17ecd18dfa7097f473186b0f947bc10db2d3e4f530e4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d7265642e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A bundle to use the PHP REPL [PsySH](https://psysh.org/) with [Symfony](https://symfony.com/). Learn more at [psysh.org](https://psysh.org/).

**Requirements:** PHP 8.1+, Symfony 6.4+

What does it do?

- Loads [PsySH](https://psysh.org/) with the full application container
- Exposes the following variables out of the box:

VariableDescription`$container`The Symfony service container (TestContainer)`$kernel`The application kernel`$parameters`All container parameters`$self`The PsySH shell instance itselfYou can also [add your own variables](#adding-custom-variables) via configuration.

Documentation
-------------

[](#documentation)

1. [Install](#install)
2. [Usage](#usage)
    1. [PsySH as a debugger](doc/debugger.md)
    2. [Reflect like a boss](doc/reflect.md)
    3. [PsySH for breakpoints](doc/breakpoint.md)
3. [Customize PsySH](#customize-psysh)
4. [Credits](#credits)

Install
-------

[](#install)

Install via [Composer](https://getcomposer.org/):

```
composer require --dev xman12/psysh-bundle
```

With [Symfony Flex](https://github.com/symfony/flex), the bundle is registered automatically in `config/bundles.php`. If you manage bundles manually, add it only for `dev`/`test` environments:

```
// config/bundles.php
return [
    // ...
    xman12\PsyshBundle\PsyshBundle::class => ['dev' => true, 'test' => true],
];
```

Usage
-----

[](#usage)

### Interactive shell

[](#interactive-shell)

```
bin/console psysh
```

Once inside the shell, you have immediate access to `$container`, `$kernel`, `$parameters` and `$self`.

[![PsySH Shell](doc/images/shell.png)](doc/images/shell.png)

### Inline breakpoints

[](#inline-breakpoints)

Place a `psysh()` call anywhere in your code to drop into an interactive shell at that point:

```
use function xman12\PsyshBundle\psysh;

class OrderService
{
    public function process(Order $order): void
    {
        // Drop into a shell with $order available and the current object bound
        psysh(['order' => $order], $this);
    }
}
```

[Go further with the docs](#documentation).

Customize PsySH
---------------

[](#customize-psysh)

### Adding a custom command

[](#adding-a-custom-command)

Tag any class extending `Psy\Command\Command` with `psysh.command`. With autoconfigure enabled (the default in Symfony 6.4), no explicit tag is needed — the bundle detects these classes automatically:

```
# config/services.yaml
services:
    _defaults:
        autoconfigure: true
        autowire: true

    Acme\Shell\MyCommand: ~
```

To add the tag explicitly:

```
services:
    Acme\Shell\MyCommand:
        tags:
            - { name: psysh.command }
```

> The bundle autoconfigures any service that inherits from `Psy\Command\Command` or `Psy\Command\ReflectingCommand`.

### Adding custom variables

[](#adding-custom-variables)

Declare extra shell variables in `config/packages/dev/psysh.yaml`:

```
# config/packages/dev/psysh.yaml
psysh:
    variables:
        foo: bar
        router: "@router"
        some: [thing, else]
        debug: "%kernel.debug%"
```

Variables can be:

- scalar values
- container parameter references (e.g. `%kernel.debug%`)
- service references (prefixed with `@`, e.g. `"@router"`)
- arrays

After running `bin/console psysh`, inspect available variables with `ls`:

```
>>> ls
Variables: $container, $kernel, $parameters, $self, $foo, $router, $some, $debug

```

Credits
-------

[](#credits)

This bundle is developed by [Théo FIDRY](https://github.com/theofidry). This project has been made possible thanks to:

- [Justin Hileman](https://github.com/bobthecow): author of [PsySH](https://psysh.org/) and [all the contributors](https://github.com/bobthecow/psysh/graphs/contributors)
- [Adrian Palmer](https://github.com/navitronic): gave the lead for porting [PsySH](https://psysh.org/) to [Symfony](https://symfony.com/)

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance93

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

34d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d8967e637cf8597985252852f1cababe1cf71456d9a201335b734834f06d6ac1?d=identicon)[xman12](/maintainers/xman12)

---

Top Contributors

[![theofidry](https://avatars.githubusercontent.com/u/5175937?v=4)](https://github.com/theofidry "theofidry (94 commits)")[![Chris53897](https://avatars.githubusercontent.com/u/7104259?v=4)](https://github.com/Chris53897 "Chris53897 (10 commits)")[![xman12](https://avatars.githubusercontent.com/u/3243905?v=4)](https://github.com/xman12 "xman12 (6 commits)")[![navitronic](https://avatars.githubusercontent.com/u/180519?v=4)](https://github.com/navitronic "navitronic (5 commits)")[![msheakoski](https://avatars.githubusercontent.com/u/4156?v=4)](https://github.com/msheakoski "msheakoski (3 commits)")[![maxhelias](https://avatars.githubusercontent.com/u/12966574?v=4)](https://github.com/maxhelias "maxhelias (3 commits)")[![soullivaneuh](https://avatars.githubusercontent.com/u/1698357?v=4)](https://github.com/soullivaneuh "soullivaneuh (2 commits)")[![roverwolf](https://avatars.githubusercontent.com/u/210211?v=4)](https://github.com/roverwolf "roverwolf (1 commits)")[![SebSept](https://avatars.githubusercontent.com/u/2592502?v=4)](https://github.com/SebSept "SebSept (1 commits)")[![vanputten](https://avatars.githubusercontent.com/u/6943823?v=4)](https://github.com/vanputten "vanputten (1 commits)")[![yched](https://avatars.githubusercontent.com/u/193080?v=4)](https://github.com/yched "yched (1 commits)")[![dlancea](https://avatars.githubusercontent.com/u/227576?v=4)](https://github.com/dlancea "dlancea (1 commits)")[![lolautruche](https://avatars.githubusercontent.com/u/313528?v=4)](https://github.com/lolautruche "lolautruche (1 commits)")[![mihaileu](https://avatars.githubusercontent.com/u/54336101?v=4)](https://github.com/mihaileu "mihaileu (1 commits)")[![Nek-](https://avatars.githubusercontent.com/u/972456?v=4)](https://github.com/Nek- "Nek- (1 commits)")[![oradwell](https://avatars.githubusercontent.com/u/5054896?v=4)](https://github.com/oradwell "oradwell (1 commits)")[![rainbow-alex](https://avatars.githubusercontent.com/u/613752?v=4)](https://github.com/rainbow-alex "rainbow-alex (1 commits)")

---

Tags

consolesymfonyREPLpsyshshellinteractive

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/xman12-psysh-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/xman12-psysh-bundle/health.svg)](https://phpackages.com/packages/xman12-psysh-bundle)
```

###  Alternatives

[psy/psysh

An interactive shell for modern PHP.

9.8k545.6M714](/packages/psy-psysh)[drupal/console

The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.

93615.1M157](/packages/drupal-console)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[ramsey/composer-repl

A REPL for PHP built into Composer.

105111.1k24](/packages/ramsey-composer-repl)[coresphere/console-bundle

This bundle allows you accessing the symfony2 console via your browser

146337.3k5](/packages/coresphere-console-bundle)[nunomaduro/collision-adapter-symfony

Collision's adapter for Symfony applications. Error Reporting for console/command-line PHP applications.

4536.8k3](/packages/nunomaduro-collision-adapter-symfony)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
