{"id":15759744,"url":"https://github.com/wyrihaximus/php-tactician-command-handler-mapper","last_synced_at":"2025-10-18T08:07:41.776Z","repository":{"id":52421222,"uuid":"66782537","full_name":"WyriHaximus/php-tactician-command-handler-mapper","owner":"WyriHaximus","description":"Command to Handler mapper for Tactician","archived":false,"fork":false,"pushed_at":"2023-12-05T05:31:21.000Z","size":125,"stargazers_count":2,"open_issues_count":4,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T23:38:43.947Z","etag":null,"topics":["command-bus","hacktoberfest","php","tactician"],"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/WyriHaximus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2016-08-28T17:55:30.000Z","updated_at":"2020-10-04T20:04:11.000Z","dependencies_parsed_at":"2024-06-21T20:24:49.562Z","dependency_job_id":"cf50b1a5-102e-4645-8565-b5ec1a791eec","html_url":"https://github.com/WyriHaximus/php-tactician-command-handler-mapper","commit_stats":{"total_commits":95,"total_committers":4,"mean_commits":23.75,"dds":0.2421052631578947,"last_synced_commit":"314cd4e34aa5f56958ee1d40030ca66672b74ba3"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fphp-tactician-command-handler-mapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fphp-tactician-command-handler-mapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fphp-tactician-command-handler-mapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fphp-tactician-command-handler-mapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WyriHaximus","download_url":"https://codeload.github.com/WyriHaximus/php-tactician-command-handler-mapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253818464,"owners_count":21969172,"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":["command-bus","hacktoberfest","php","tactician"],"created_at":"2024-10-04T10:23:03.095Z","updated_at":"2025-10-18T08:07:36.730Z","avatar_url":"https://github.com/WyriHaximus.png","language":"PHP","readme":"# Command to Handler mapper for [`Tactician`](http://tactician.thephpleague.com/)\n\n[![Build Status](https://travis-ci.org/wyrihaximus/php-tactician-command-handler-mapper.svg?branch=master)](https://travis-ci.org/wyrihaximus/php-tactician-command-handler-mapper)\n[![Latest Stable Version](https://poser.pugx.org/wyrihaximus/tactician-command-handler-mapper/v/stable.png)](https://packagist.org/packages/wyrihaximus/tactician-command-handler-mapper)\n[![Total Downloads](https://poser.pugx.org/wyrihaximus/tactician-command-handler-mapper/downloads.png)](https://packagist.org/packages/wyrihaximus/tactician-command-handler-mapper/stats)\n[![Code Coverage](https://scrutinizer-ci.com/g/wyrihaximus/php-tactician-command-handler-mapper/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/wyrihaximus/php-tactician-command-handler-mapper/?branch=master)\n[![License](https://poser.pugx.org/wyrihaximus/tactician-command-handler-mapper/license.png)](https://packagist.org/packages/wyrihaximus/tactician-command-handler-mapper)\n[![PHP 7 ready](http://php7ready.timesplinter.ch/wyrihaximus/php-tactician-command-handler-mapper/badge.svg)](https://travis-ci.org/wyrihaximus/php-tactician-command-handler-mapper)\n\n\n# Install\n\nTo install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `^`.\n\n```\ncomposer require wyrihaximus/tactician-command-handler-mapper\n```\n\n# Set up\n\nWhen creating a `Command` add the `@Handler` annotation to map it to a `Handler`.\n\n```php\n\u003c?php\n\nnamespace Test\\App\\Commands;\n\nuse WyriHaximus\\Tactician\\CommandHandler\\Annotations\\Handler;\n\n/**\n * @Handler(\"Test\\App\\Handlers\\AwesomesauceHandler\")\n */\nclass AwesomesauceCommand\n{\n    /**\n     * @var string\n     */\n    private $value;\n\n    /**\n     * AwesomesauceCommand constructor.\n     * @param string $value\n     */\n    public function __construct($value)\n    {\n        $this-\u003evalue = $value;\n    }\n\n    /**\n     * @return string\n     */\n    public function getValue()\n    {\n        return $this-\u003evalue;\n    }\n}\n```\n\n# Mapping\n\nThe mapper needs a path where it can find commands. From there it scans all classes it finds for the `@Handler` annotation ad returns a map of commands and handlers that match.\n\n## Mapper::mapInstantiated\n\nFor when you want to get started quickly and non of you handlers need to get dependencies injected.\n\n```php\nuse League\\Tactician\\Setup\\QuickStart;\nuse WyriHaximus\\Tactician\\CommandHandler\\Mapper;\n\n$commandBus = QuickStart::create(\n    Mapper::mapInstanciated('src' . DS . 'CommandBus')\n);\n```\n\n## Mapper::map\n\nFor when you don't want a set instanciated handlers, for exampe useful when using [`league/tactician-container`](http://tactician.thephpleague.com/plugins/container/) for automatic dependency injection.\n\n```php\nuse League\\Tactician\\Setup\\QuickStart;\n\n$commandToHandlerMap = Mapper::map('src' . DS . 'CommandBus');\n```\n\n# License\n\nThe MIT License (MIT)\n\nCopyright (c) 2017 Cees-Jan Kiewiet\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyrihaximus%2Fphp-tactician-command-handler-mapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwyrihaximus%2Fphp-tactician-command-handler-mapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyrihaximus%2Fphp-tactician-command-handler-mapper/lists"}