{"id":30367254,"url":"https://github.com/elfsundae/console","last_synced_at":"2025-08-19T23:14:07.939Z","repository":{"id":56976567,"uuid":"100198819","full_name":"ElfSundae/console","owner":"ElfSundae","description":"CLI library based on Laravel Console for creating PHP console application.","archived":false,"fork":false,"pushed_at":"2017-09-20T14:07:38.000Z","size":23,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T08:02:44.774Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ElfSundae.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-13T19:12:21.000Z","updated_at":"2022-11-12T08:30:16.000Z","dependencies_parsed_at":"2022-08-21T10:20:56.686Z","dependency_job_id":null,"html_url":"https://github.com/ElfSundae/console","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ElfSundae/console","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElfSundae%2Fconsole","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElfSundae%2Fconsole/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElfSundae%2Fconsole/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElfSundae%2Fconsole/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ElfSundae","download_url":"https://codeload.github.com/ElfSundae/console/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElfSundae%2Fconsole/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271236297,"owners_count":24723983,"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","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-08-19T23:14:07.091Z","updated_at":"2025-08-19T23:14:07.926Z","avatar_url":"https://github.com/ElfSundae.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Version on Packagist](https://img.shields.io/packagist/v/elfsundae/console.svg?style=flat-square)](https://packagist.org/packages/elfsundae/console)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/ElfSundae/console/master.svg?style=flat-square)](https://travis-ci.org/ElfSundae/console)\n[![StyleCI](https://styleci.io/repos/100198819/shield)](https://styleci.io/repos/100198819)\n[![SensioLabsInsight](https://img.shields.io/sensiolabs/i/4658ebb9-710d-40fb-9573-1d8ada1991b4.svg?style=flat-square)](https://insight.sensiolabs.com/projects/4658ebb9-710d-40fb-9573-1d8ada1991b4)\n[![Quality Score](https://img.shields.io/scrutinizer/g/ElfSundae/console.svg?style=flat-square)](https://scrutinizer-ci.com/g/ElfSundae/console)\n[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/ElfSundae/console/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/ElfSundae/console/?branch=master)\n[![Total Downloads](https://img.shields.io/packagist/dt/elfsundae/console.svg?style=flat-square)](https://packagist.org/packages/elfsundae/console)\n\nCLI library based on [Laravel Console][Laravel Artisan] for creating PHP console application.\n\n## Installation\n\n```sh\n$ composer require elfsundae/console\n```\n\n## Usage\n\nFirst, create a PHP script and make it executable:\n\n```php\n#!/usr/bin/env php\n\u003c?php\n\nrequire __DIR__.'/vendor/autoload.php';\n\n$app = new ElfSundae\\Console\\Application;\n\n// ... register commands\n\n$app-\u003erun();\n```\n\nThen, you can register commands using `add` or `command` method.\n\nThe `add` method accepts an `Illuminate\\Console\\Command` instance or a `Symfony\\Component\\Console\\Command\\Command` instance. The `command` method may be used for register a Closure based command, it accepts three arguments: the command signature, a Closure which receives the commands arguments and options, and the optional description of the command.\n\n```php\nclass Example extends Illuminate\\Console\\Command\n{\n    protected $signature = 'example\n        {--foo=bar : The \"foo\" option description}';\n\n    protected $description = 'Example command description';\n\n    public function handle()\n    {\n        $this-\u003ecomment($this-\u003eoption('foo'));\n    }\n}\n\n$app-\u003eadd(new Example);\n\n$app-\u003ecommand('title {username}', function ($username) {\n    $this-\u003ecomment(title_case($username));\n}, 'The `title` command description');\n```\n\nTo build a single command application, you may pass `true` to the second argument of the `setDefaultCommand` method, or just call the `runAsSingle` method:\n\n```php\n(new ElfSundae\\Console\\Application)\n    -\u003eadd($command = new Example)\n    -\u003egetApplication()\n    -\u003esetDefaultCommand($command-\u003egetName(), true)\n    -\u003erun();\n```\n\n```php\n(new ElfSundae\\Console\\Application)\n    -\u003eadd(new Example)\n    -\u003egetApplication()\n    -\u003erunAsSingle();\n```\n\n## Documentation\n\n- [Laravel Artisan][]\n- [Symfony Console Component][]\n\n## Testing\n\n```sh\n$ composer test\n```\n\n## License\n\nThis package is open-sourced software licensed under the [MIT License](LICENSE.md).\n\n[Laravel Artisan]: https://laravel.com/docs/artisan\n[Symfony Console Component]: http://symfony.com/doc/current/components/console.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felfsundae%2Fconsole","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felfsundae%2Fconsole","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felfsundae%2Fconsole/lists"}