Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/antidot-framework/tactician-adapter

Tactician Command Bus PSR-11 compatible factories
https://github.com/antidot-framework/tactician-adapter

command-bus psr-11 tactician

Last synced: 3 days ago
JSON representation

Tactician Command Bus PSR-11 compatible factories

Awesome Lists containing this project

README

        

# Antidot Framework Tactician Adapter

[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-travis]][link-travis]
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
[![Quality Score][ico-code-quality]][link-code-quality]
[![Total Downloads][ico-downloads]][link-downloads]

## Getting started

### Installation

````
composer require antidot-fw/tactician
````

### Config

Create `command-bus.global.php` file inner config autoload directory.

````php
[
'invokables' => [
\App\Handler\PingHandler::class => \App\Handler\PingHandler::class,
]
],
'command-bus' => [
'handler-map' => [
\App\Command\PingCommand::class => \App\Handler\PingHandler::class
],
],
];
````

Example command and handler.

````php
$this->bus->handle(new PingCommand())]);
}
}
````

## Modify Command Bus

You can modify the entire command bus to meet the needs of your project.

This is default config.

````php
[
'locator' => \League\Tactician\Handler\Locator\HandlerLocator::class,
'inflector' => \League\Tactician\Handler\MethodNameInflector\MethodNameInflector::class,
'extractor' => \League\Tactician\Handler\CommandNameExtractor\CommandNameExtractor::class,
'middleware' => [
\League\Tactician\Plugins\LockingMiddleware::class,
\League\Tactician\Logger\LoggerMiddleware::class,
\League\Tactician\CommandEvents\EventMiddleware::class,

],
],
];
````

## Query Bus

You can use a query bus too, the difference with the command bus is that the query bus will always return an object.

```php
[
'locator' => 'query_bus.handler_locator',
'inflector' => \League\Tactician\Handler\MethodNameInflector\MethodNameInflector::class,
'extractor' => \League\Tactician\Handler\CommandNameExtractor\CommandNameExtractor::class,
'middleware' => [

],
],
];
```

[ico-version]: https://img.shields.io/packagist/v/antidot-fw/tactician.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-BSD%202--Clause-brightgreen.svg?style=flat-square
[ico-travis]: https://img.shields.io/scrutinizer/build/g/antidot-framework/tactician-adapter.svg?style=flat-square
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/antidot-framework/tactician-adapter.svg?style=flat-square
[ico-code-quality]: https://img.shields.io/scrutinizer/g/antidot-framework/tactician-adapter.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/antidot-fw/tactician.svg?style=flat-square

[link-packagist]: https://packagist.org/packages/antidot-fw/tactician
[link-travis]: https://scrutinizer-ci.com/g/antidot-framework/tactician-adapter/
[link-scrutinizer]: https://scrutinizer-ci.com/g/antidot-framework/tactician-adapter/code-structure
[link-code-quality]: https://scrutinizer-ci.com/g/antidot-framework/tactician-adapter/badges/coverage.png?b=master
[link-downloads]: https://packagist.org/packages/antidot-fw/tactician
[link-author]: https://github.com/kpicaza
[link-contributors]: ../../contributors