{"id":22081763,"url":"https://github.com/fieg/shell","last_synced_at":"2025-03-23T21:13:15.613Z","repository":{"id":32193331,"uuid":"35766880","full_name":"fieg/shell","owner":"fieg","description":"Interactive shell (cli) component for PHP","archived":false,"fork":false,"pushed_at":"2015-05-17T20:09:19.000Z","size":132,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-29T04:35:00.270Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fieg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-17T13:20:53.000Z","updated_at":"2018-06-12T03:24:48.000Z","dependencies_parsed_at":"2022-09-11T17:24:57.574Z","dependency_job_id":null,"html_url":"https://github.com/fieg/shell","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fieg%2Fshell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fieg%2Fshell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fieg%2Fshell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fieg%2Fshell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fieg","download_url":"https://codeload.github.com/fieg/shell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245168912,"owners_count":20571804,"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":[],"created_at":"2024-11-30T23:25:18.926Z","updated_at":"2025-03-23T21:13:15.589Z","avatar_url":"https://github.com/fieg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Interactive shell (cli) component for PHP\n\n[![Build Status](https://travis-ci.org/fieg/shell.png?branch=master)](https://travis-ci.org/fieg/shell)\n\nGetting started\n---------------\n\n```php\nuse Fieg\\Shell\\Shell;\nuse Fieg\\Shell\\ShellEvents;\n\n$shell = new Shell();\n\n// handle some commands\n$shell-\u003eon(ShellEvents::COMMAND, function ($command) use ($shell) {\n    switch ($command) {\n        case \"help\":\n            $shell-\u003epublish('Available commands:');\n            $shell-\u003epublish('  help   Print this help');\n            $shell-\u003epublish('  exit   Exit program');\n            break;\n\n        case \"exit\":\n            $shell-\u003estop();\n            break;\n\n        // echo everything else the user types\n        default:\n            $shell-\u003epublish('echo: ' . $command);\n    }\n});\n\n// print some info\n$shell-\u003epublish(\"This is an interactive shell.\");\n$shell-\u003epublish(\"Type 'help' for all available commands.\");\n\n// start a prompt so we can receive user input\n$shell-\u003eprompt();\n\n// statements after this are only executed when `$shell-\u003estop()` is called\n$shell-\u003erun();\n\necho \"Bye!\" . PHP_EOL;\n```\n\nThis library also comes with a history support. With this you can use the up and down arrows to\nbrowse through the recently typed commands. To enable the history support, just wrap the Shell\nclass in a HistoryDecorator:\n\n```php\n$shell = new HistoryDecorator(new Shell());\n```\n\nYou can also type the command \"history\" to see a list of all recently typed commands.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffieg%2Fshell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffieg%2Fshell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffieg%2Fshell/lists"}