{"id":23512772,"url":"https://github.com/baethon/symfony-console-input","last_synced_at":"2026-01-29T23:03:14.609Z","repository":{"id":264376163,"uuid":"893195565","full_name":"baethon/symfony-console-input","owner":"baethon","description":"Generates command signature based on an input DTO","archived":false,"fork":false,"pushed_at":"2024-11-23T21:55:45.000Z","size":57,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-01T11:07:45.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/baethon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-23T19:31:11.000Z","updated_at":"2025-02-19T12:00:55.000Z","dependencies_parsed_at":"2024-11-23T22:50:24.076Z","dependency_job_id":null,"html_url":"https://github.com/baethon/symfony-console-input","commit_stats":null,"previous_names":["baethon/symfony-console-input"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/baethon/symfony-console-input","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baethon%2Fsymfony-console-input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baethon%2Fsymfony-console-input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baethon%2Fsymfony-console-input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baethon%2Fsymfony-console-input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baethon","download_url":"https://codeload.github.com/baethon/symfony-console-input/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baethon%2Fsymfony-console-input/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28889863,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T21:06:44.224Z","status":"ssl_error","status_checked_at":"2026-01-29T21:06:42.160Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2024-12-25T13:19:25.130Z","updated_at":"2026-01-29T23:03:14.603Z","avatar_url":"https://github.com/baethon.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Symfony Console Input Plugin\n\nThis project provides a streamlined way to define Symfony Console commands using PHP attributes and Data Transfer Objects (DTOs). It simplifies the configuration of arguments and options by leveraging metadata annotations, making it easier to maintain and extend console commands.\n\n## Features\n\n- Automatically generates command arguments and options from DTO properties.\n- Supports metadata annotations (`#[Argument]`, `#[Option]`, etc.) to define command inputs.\n- Easily integrates with Symfony's Console component.\n- Provides a `UsesInputData` trait to configure and initialize input data automatically.\n\n## Requirements\n\n- PHP \u003e= 8.4\n\n## Installation\n\nTo install the plugin, use Composer:\n\n```bash\ncomposer require baethon/symfony-console-input\n```\n\n## Getting Started\n\n### 1. Define Your Input DTO\n\nCreate a class with properties annotated using provided attributes like `#[Argument]` or `#[Option]`. \n\n```php\nuse Baethon\\Symfony\\Console\\Input\\Attributes\\Argument;\nuse Baethon\\Symfony\\Console\\Input\\Attributes\\Option;\n\nreadonly class MyCommandInput\n{\n    public function __construct(\n        #[Argument]\n        public string $name,   // A required argument\n\n        #[Option]\n        public int $age = 18,  // An optional option with a default value\n    ) {}\n}\n```\n\n\u003e [!IMPORTANT]\n\u003e The input class must define all arguments and options in the constructor.\n\n### 2. Create a Command\n\nUse the `UsesInputData` trait in your Symfony Console command class to leverage the input configuration:\n\n```php\nuse Baethon\\Symfony\\Console\\Input\\Attributes\\InputData;\nuse Baethon\\Symfony\\Console\\Input\\UsesInputData;\nuse Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\Attribute\\AsCommand;\n\n#[AsCommand(name: 'my-command')]\nclass MyCommand extends Command\n{\n    use UsesInputData;\n\n    #[InputData]\n    private MyCommandInput $input;\n\n    protected function execute(InputInterface $input, OutputInterface $output): int\n    {\n        $output-\u003ewriteln(\"Name: {$this-\u003einput-\u003ename}\");\n        $output-\u003ewriteln(\"Age: {$this-\u003einput-\u003eage}\");\n\n        return Command::SUCCESS;\n    }\n}\n```\n\n## Attributes\n\n### `#[Argument]`\n\nMarks a property as a required/optional argument.\n\n### `#[Option]`\n\nMarks a property as an option.\n\n### `#[Shortcut]`\n\nDefines a shortcut for an option.\n\n### `#[Description]`\n\nAdds a description for the argument or option.\n\n### `#[Name]`\n\nSets a different name for the argument or option.\n\n## Testing\n\nRun tests using Pest:\n\n```bash\n./vendor/bin/pest\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaethon%2Fsymfony-console-input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaethon%2Fsymfony-console-input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaethon%2Fsymfony-console-input/lists"}