{"id":14128425,"url":"https://github.com/theofidry/PsyshBundle","last_synced_at":"2025-08-03T23:30:46.254Z","repository":{"id":29629165,"uuid":"33170045","full_name":"theofidry/PsyshBundle","owner":"theofidry","description":"A command line REPL bundle for Symfony using PsySH.","archived":false,"fork":true,"pushed_at":"2024-02-26T11:14:26.000Z","size":1325,"stargazers_count":209,"open_issues_count":10,"forks_count":28,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-02T01:24:25.520Z","etag":null,"topics":["debug","php","repl","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"navitronic/psymf","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theofidry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["theofidry"]}},"created_at":"2015-03-31T06:59:05.000Z","updated_at":"2024-04-24T13:59:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"ff31a276-8b18-49f5-b71e-2ed60371cd4b","html_url":"https://github.com/theofidry/PsyshBundle","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theofidry%2FPsyshBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theofidry%2FPsyshBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theofidry%2FPsyshBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theofidry%2FPsyshBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theofidry","download_url":"https://codeload.github.com/theofidry/PsyshBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228571844,"owners_count":17938772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debug","php","repl","symfony","symfony-bundle"],"created_at":"2024-08-15T16:01:42.395Z","updated_at":"2024-12-07T06:31:13.785Z","avatar_url":"https://github.com/theofidry.png","language":"PHP","funding_links":["https://github.com/sponsors/theofidry"],"categories":["PHP","Development"],"sub_categories":[],"readme":"# PsyshBundle\n\n[![Package version](http://img.shields.io/packagist/v/theofidry/psysh.svg?style=flat-square)](https://packagist.org/packages/theofidry/psysh-bundle)\n[![Build Status](https://img.shields.io/travis/theofidry/PsyshBundle.svg?branch=master\u0026style=flat-square)](https://travis-ci.org/theofidry/PsyshBundle?branch=master)\n[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/theofidry/PsyshBundle.svg?style=flat-square)](https://scrutinizer-ci.com/g/theofidry/PsyshBundle/?branch=master)\n[![License](https://img.shields.io/badge/license-MIT-red.svg?style=flat-square)](LICENSE)\n\nA bundle to use the php REPL [PsySH][1] with [Symfony][2]. Learn more at [psysh.org][1] and check out the [Interactive Debugging in PHP talk from OSCON](https://presentate.com/bobthecow/talks/php-for-pirates) on Presentate.\n\nWhat does it do exactly?\n* Loads [PsySH][1] with the application dependencies\n* Gives access to the following variables:\n\n| Variable              | Description                          |\n|-----------------------|--------------------------------------|\n| `$container`          | Instance of Symfony ServiceContainer |\n| `$kernel`             | Instance of Symfony Kernel           |\n| `$parameters`         | Instance of Symfony parameters       |\n\nAside from that it's the plain old [PsySH][1]! You can also [customize it](#customize-psysh) to add your own variables.\n\n\n## Documentation\n\n1. [Install](#install)\n1. [Usage](#usage)\n    1. [PsySH as a debugger](doc/debugger.md)\n    1. [Reflect like a boss](doc/reflect.md)\n    1. [PsySH for breakpoints](doc/breakpoint.md)\n1. [Customize PsySH](#customize-psysh)\n1. [Credits](#credits)\n\n\n## Install\n\nYou can use [Composer](https://getcomposer.org/) to install the bundle to your project:\n\n```bash\ncomposer require --dev theofidry/psysh-bundle\n```\n\nThen, enable the bundle by updating your `app/AppKernel.php` file to enable the bundle:  \n(not needed on symfony 5, bundle is automaticaly registred in `config/bundles.php`)\n```php\n\u003c?php\n// app/AppKernel.php\n\npublic function registerBundles()\n{\n    //...\n\n    if (in_array($this-\u003egetEnvironment(), ['dev', 'test'])) {\n        //...\n        $bundles[] = new Fidry\\PsyshBundle\\PsyshBundle();\n    }\n\n    return $bundles;\n}\n```\n\n## Usage\n\n```bash\n# Symfony \u003e 4.0\nbin/console psysh\n```\n\nor\n\n```php\nuse function psysh\n\nclass X\n{\n    function foo()\n    {\n        psysh(get_defined_vars(), $this);   // Debug with the current context\n    }\n}\n```\n\n![PsySH Shell](doc/images/shell.png)\n\n[Go further](#documentation).\n\n\n## Customize PsySH\n\n### Adding a custom command\nAdding a custom command for PsySH is as simple as defining a service with `psysh.command` tag!\n\n```yaml\nservices:\n    my_psysh_command:\n        class: Acme\\Shell\\MyCommand\n        tags:\n            - { name: psysh.command }\n```\n\nOr even simpler if you use Symfony 3.3+:\n\n```yaml\nservices:\n    _defaults:\n        autoconfigure: true\n        autowire: true\n        public: false\n\n    Acme\\Shell\\MyCommand: ~\n```\n\n\u003e PsyshBundle provides autoconfiguration for custom Psysh command services, as long as they inherit from\n\u003e `Psy\\Command\\ReflectingCommand` or `Psy\\Command\\Command`.\n\n### Adding custom variables\nIt is possible to add custom variables to the shell via configuration.\nVariables can be of any type, container parameters references (e.g. `%kernel.debug%`) or even services\n(prefixed with `@`, e.g. `\"@my_service\"`).\n\n```yaml\n# app/config/config_dev.yml\n\npsysh:\n    variables:\n        foo: bar\n        router: \"@router\"\n        some: [thing, else]\n        debug: \"%kernel.debug%\"\n```\n\nNow if you run `php app/console psysh` and then `ls`, you will see the variables `$foo`, `$router`, `$some` and `$debug`,\nin addition to already defined variables:\n\n```\n\u003e\u003e\u003e ls\nVariables: $foo, $router, $some, $debug...\n```\n\nDefault variables are:\n- `$container` (the service container)\n- `$kernel`\n- `$parameters` (all container parameters)\n- `$self` (the PsySH shell itself)\n\n\n## Credits\n\nThis bundle is developed by [Théo FIDRY](https://github.com/theofidry). This project has been made possible thanks to:\n\n* [Justin Hileman](https://github.com/bobthecow): author of [PsySH][1] and [all the contributors of the PsySH project](https://github.com/bobthecow/psysh/graphs/contributors)\n* [Adrian Palmer](https://github.com/navitronic): gave the lead for porting [PsySH][1] on [Symfony][2]\n\n\n[1]: https://psysh.org/\n[2]: https://symfony.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheofidry%2FPsyshBundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheofidry%2FPsyshBundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheofidry%2FPsyshBundle/lists"}