{"id":22894280,"url":"https://github.com/clearcodehq/command-bus-console","last_synced_at":"2025-05-07T19:21:11.267Z","repository":{"id":56953638,"uuid":"44962746","full_name":"ClearcodeHQ/command-bus-console","owner":"ClearcodeHQ","description":"CLI for command bus","archived":false,"fork":false,"pushed_at":"2015-12-15T10:43:40.000Z","size":0,"stargazers_count":4,"open_issues_count":2,"forks_count":1,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-30T13:37:08.517Z","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/ClearcodeHQ.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-26T10:56:38.000Z","updated_at":"2018-11-22T11:22:06.000Z","dependencies_parsed_at":"2022-08-21T08:50:07.545Z","dependency_job_id":null,"html_url":"https://github.com/ClearcodeHQ/command-bus-console","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClearcodeHQ%2Fcommand-bus-console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClearcodeHQ%2Fcommand-bus-console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClearcodeHQ%2Fcommand-bus-console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClearcodeHQ%2Fcommand-bus-console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ClearcodeHQ","download_url":"https://codeload.github.com/ClearcodeHQ/command-bus-console/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252941382,"owners_count":21828866,"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-12-13T23:17:23.004Z","updated_at":"2025-05-07T19:21:11.246Z","avatar_url":"https://github.com/ClearcodeHQ.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/ClearcodeHQ/command-bus-console.svg?branch=master)](https://travis-ci.org/ClearcodeHQ/command-bus-console)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ClearcodeHQ/command-bus-console/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/ClearcodeHQ/command-bus-console/?branch=master)\n[![MIT License](https://img.shields.io/packagist/l/clearcode/command-bus-console.svg)](https://github.com/ClearcodeHQ/command-bus-console/blob/master/LICENSE)\n\n# Command Bus Console\n\nCommand Bus Console is a package exposing your command bus functionality to the CLI.\nCommand Bus Console is based on [Symfony Console Form](https://github.com/matthiasnoback/symfony-console-form)\nand [https://github.com/SimpleBus](https://github.com/SimpleBus). \n\n# Installation\n\n```console\n$ composer require clearcode/command-bus-console\n```\n\nEnable bundles in the kernel of your Symfony application.\n\n```php\n    \u003c?php\n    // app/AppKernel.php\n\n    public function registerBundles()\n    {\n        $bundles = array(\n            // ...\n            new SimpleBusCommandBusBundle(), // this one you probably have already registered\n            new SymfonyConsoleFormBundle(),\n            new Clearcode\\CommandBusConsole\\Bundle\\CommandBusConsoleBundle(),\n        );\n    }\n```\n\n# Usage\n\n## Create and register form type for your command.\n\nAssumed that you already have a command class and its handler class, create form type class mapping your command properties:\n\n```php\nclass SignUpType extends AbstractType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options)\n    {\n        $builder\n            -\u003eadd('id', TextType::class, [\n                'label' =\u003e 'Id',\n            ])\n            -\u003eadd('name', TextType::class, [\n                'label' =\u003e 'Name',\n            ])\n            -\u003eadd('email', TextType::class, [\n                'label' =\u003e 'email',\n            ])\n        ;\n    }\n\n    public function setDefaultOptions(OptionsResolverInterface $resolver)\n    {\n        $resolver-\u003esetDefaults([\n            'data_class' =\u003e SignUp::class,\n        ]);\n    }\n\n    ...\n}\n```\n\nAnd register your form type using `command_bus.type` with required attributes `command` which is FQCN of your command\nand `alias` which will be used to register console command with name `command-bus:alias`.\n\n```yaml\n    form_type_service_id:\n        class: Fully\\Qualified\\Class\\Name\\Of\\SignUpType\n        tags:\n            - { name: form.type }\n            - { name: command_bus.type, command: Fully\\Qualified\\Class\\Name\\Of\\SignUp, alias: sign-up }\n```\n\n## Run command in interactive mode\n\n```console\n$ bin/console command-bus:sign-up\nId:\nName:\nemail:\n\n[2015-12-11 10:34:55] The Fully\\Qualified\\Class\\Name\\Of\\SignUp executed with success.\n```\n\n## Run command in non interactive mode\n\n```console\n$ bin/console command-bus:alias-for-command --no-interaction --id=1 --name=John --email=john@doe.com\n\n[2015-12-11 10:34:55] The Fully\\Qualified\\Class\\Name\\Of\\SignUp executed with success.\n```\n\n# To Do\n- [ ] All fields should be required\n- [ ] Add generating form types on the fly\n- [ ] Add support for instantiating command objects via `__construct`\n- [ ] Add possibility to use any command bus implementation\n - [ ] Introduce abstraction on command bus\n\n\n# License\n\nMIT, see LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclearcodehq%2Fcommand-bus-console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclearcodehq%2Fcommand-bus-console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclearcodehq%2Fcommand-bus-console/lists"}