{"id":13803757,"url":"https://github.com/ramsey/composer-repl","last_synced_at":"2025-05-16T19:08:01.295Z","repository":{"id":45184474,"uuid":"290004952","full_name":"ramsey/composer-repl","owner":"ramsey","description":":shell: A REPL for PHP built into Composer (using PsySH)","archived":false,"fork":false,"pushed_at":"2025-03-06T02:08:11.000Z","size":170,"stargazers_count":103,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-10T06:41:43.904Z","etag":null,"topics":["composer","composer-plugin","php","psysh","repl"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ramsey.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ramsey"}},"created_at":"2020-08-24T18:16:48.000Z","updated_at":"2025-05-03T13:22:09.000Z","dependencies_parsed_at":"2024-06-18T15:33:25.691Z","dependency_job_id":"44d7705c-3f19-40ef-afc6-216f5a55d79c","html_url":"https://github.com/ramsey/composer-repl","commit_stats":{"total_commits":70,"total_committers":1,"mean_commits":70.0,"dds":0.0,"last_synced_commit":"2bce19258b7244f99b0a6099f3ecf571bbc4eaeb"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramsey%2Fcomposer-repl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramsey%2Fcomposer-repl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramsey%2Fcomposer-repl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramsey%2Fcomposer-repl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ramsey","download_url":"https://codeload.github.com/ramsey/composer-repl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254592395,"owners_count":22097013,"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":["composer","composer-plugin","php","psysh","repl"],"created_at":"2024-08-04T01:00:37.616Z","updated_at":"2025-05-16T19:08:01.264Z","avatar_url":"https://github.com/ramsey.png","language":null,"readme":"\u003ch1 align=\"center\"\u003eramsey/composer-repl\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cstrong\u003eA REPL for PHP built into Composer.\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/ramsey/composer-repl\"\u003e\u003cimg src=\"https://img.shields.io/badge/source-ramsey/composer--repl-blue.svg?style=flat-square\" alt=\"Source Code\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/ramsey/composer-repl\"\u003e\u003cimg src=\"https://img.shields.io/packagist/v/ramsey/composer-repl.svg?style=flat-square\u0026label=release\" alt=\"Download Package\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://php.net\"\u003e\u003cimg src=\"https://img.shields.io/packagist/php-v/ramsey/composer-repl.svg?style=flat-square\u0026colorB=%238892BF\" alt=\"PHP Programming Language\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/ramsey/composer-repl/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/packagist/l/ramsey/composer-repl.svg?style=flat-square\u0026colorB=darkcyan\" alt=\"Read License\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/ramsey/composer-repl-lib/actions/workflows/continuous-integration.yml\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/ramsey/composer-repl-lib/continuous-integration.yml?branch=main\u0026style=flat-square\u0026logo=github\" alt=\"Build Status\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/ramsey/composer-repl-lib\"\u003e\u003cimg src=\"https://img.shields.io/codecov/c/gh/ramsey/composer-repl-lib?label=codecov\u0026logo=codecov\u0026style=flat-square\" alt=\"Codecov Code Coverage\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## About\n\nThis [Composer](https://getcomposer.org) plugin provides the `composer repl`\ncommand.\n\nREPL stands for *read-eval-print loop*. It's a language shell that reads user\ninput, evaluates the input using a programming language (in this case, PHP), and\nprints the output to the screen. Then, it returns to the read state (that's the\n*loop* part).\n\n[PsySH](https://psysh.org) is the REPL providing the magic behind\nramsey/composer-repl. PsySH is a language shell for PHP. It's similar to\n[irb](https://github.com/ruby/irb) for Ruby, [IPython](https://ipython.org) for\nPython, and [JShell](https://docs.oracle.com/javase/9/tools/jshell.htm) for\nJava. In addition to acting as a language shell, PsySH can also function as an\ninteractive debugger and development console.\n[Laravel Tinker](https://github.com/laravel/tinker), [Drush](https://www.drush.org)\nfor Drupal, [WP-CLI shell](https://github.com/wp-cli/shell-command)\nfor WordPress, [CakePHP console](https://book.cakephp.org/3/en/console-and-shells/repl.html),\nand [Yii shell](https://github.com/yiisoft/yii2-shell) are a few of the projects\nusing PsySH.\n\n\u003e [!TIP]\n\u003e You may use this REPL without the Composer plugin functionality by requiring\n\u003e [ramsey/composer-repl-lib](https://github.com/ramsey/composer-repl-lib) instead.\n\nThis project adheres to a [code of conduct](CODE_OF_CONDUCT.md).\nBy participating in this project and its community, you are expected to\nuphold this code.\n\n## Installation\n\nInstall this package as a development dependency using\n[Composer](https://getcomposer.org).\n\n``` bash\ncomposer require --dev ramsey/composer-repl\n```\n\n## Usage\n\nOpen your terminal and type `composer repl`. You may also type `composer shell`,\nif you prefer.\n\nYou'll see something similar to this:\n\n```\nPsy Shell v0.12.7 (PHP 8.4.4 — cli) by Justin Hileman\n------------------------------------------------------------------------\nWelcome to the development console (REPL).\nTo learn more about what you can do in PsySH, type `help`.\n------------------------------------------------------------------------\n\u003e\u003e\u003e\n```\n\nWhile in the dev console, you can do cool things like this:\n\n``` php\n\u003e\u003e\u003e $hello = 'Hello, world'\n=\u003e \"Hello, world\"\n\n\u003e\u003e\u003e echo $hello\nHello, world\n\n\u003e\u003e\u003e foreach ([1, 2, 3] as $x) echo $x . \"\\n\"\n1\n2\n3\n\n\u003e\u003e\u003e $date = new DateTimeImmutable();\n=\u003e DateTimeImmutable @1598393282 {#6953\n     date: 2020-08-25 22:08:02.643076 UTC (+00:00),\n   }\n\n\u003e\u003e\u003e $getDate = fn (DateTimeInterface $dt): DateTimeInterface =\u003e $dt;\n=\u003e Closure(DateTimeInterface $dt): DateTimeInterface {#6964 …3}\n\n\u003e\u003e\u003e t assertInstanceOf(DateTimeInterface::class, $date);\nTest passed!\n\n\u003e\u003e\u003e t assertSame($date, $getDate($date))\nTest passed!\n\n\u003e\u003e\u003e phpunit\n\nPHPUnit 12.0.6 by Sebastian Bergmann and contributors.\n\nRuntime:       PHP 8.4.4\nConfiguration: /path/to/ramsey/conventional-commits/phpunit.xml.dist\n\n...............................................................  63 / 221 ( 28%)\n............................................................... 126 / 221 ( 57%)\n............................................................... 189 / 221 ( 85%)\n................................                                221 / 221 (100%)\n\nTime: 00:00.064, Memory: 12.00 MB\n\nOK (221 tests, 484 assertions)\n```\n\n\u003e [!IMPORTANT]\n\u003e ✨🐘 This implementation of PsySH has Super ElePHPant Powers. 🐘✨\n\n## Environment Bootstrapping\n\nThe power of this REPL comes in its ability to act as a tool in your local\ndevelopment environment. So, you might want to load parts of your environment\n(i.e., configuration, objects, etc.), so you can access these from within the\nREPL.\n\nYou can do this by specifying any number of PHP scripts to include in\n`composer.json`, like this:\n\n``` json\n{\n    \"extra\": {\n        \"ramsey/composer-repl\": {\n            \"includes\": [\n                \"repl.php\",\n                \"tests/bootstrap.php\"\n            ]\n        }\n    }\n}\n```\n\nAny variables set or configuration loaded from these scripts is available to use\nfrom within the REPL.\n\nFor example, if `repl.php` contains:\n\n``` php\n\u003c?php\n$foo = 'bar';\n```\n\nAnd we use `composer.json` to load it with the REPL:\n\n``` json\n{\n    \"extra\": {\n        \"ramsey/composer-repl\": {\n            \"includes\": [ \"repl.php\" ]\n        }\n    }\n}\n```\n\nThen, when we're in the REPL, we'll see `$foo` defined:\n\n```\n\u003e\u003e\u003e ls\nVariables: $env, $foo, $phpunit\n\n\u003e\u003e\u003e $foo\n=\u003e \"bar\"\n```\n\n## Contributing\n\nContributions are welcome! To contribute, please familiarize yourself with\n[CONTRIBUTING.md](CONTRIBUTING.md).\n\n## Coordinated Disclosure\n\nKeeping user information safe and secure is a top priority, and we welcome the\ncontribution of external security researchers. If you believe you've found a\nsecurity issue in software that is maintained in this repository, please read\n[SECURITY.md](SECURITY.md) for instructions on submitting a vulnerability report.\n\n## Copyright and License\n\nThe ramsey/composer-repl plugin is copyright © [Ben Ramsey](https://benramsey.com)\nand licensed for use under the terms of the\nMIT License (MIT). Please see [LICENSE](LICENSE) for more information.\n","funding_links":["https://github.com/sponsors/ramsey"],"categories":["Plugins"],"sub_categories":["Support"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framsey%2Fcomposer-repl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Framsey%2Fcomposer-repl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framsey%2Fcomposer-repl/lists"}