定制 luri/tactician-container-auto 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

luri/tactician-container-auto

Composer 安装命令:

composer require luri/tactician-container-auto

包简介

Tactician integration for any container implementing PSR-11 with handler autofind (based on tactician-container)

README 文档

README

This plugin allows lazy loading CommandHandlers from a PSR-11 container.

This plugin add an autofind functionnality to league/tactician-container plugin. It's require league/tactician-container

This functionnality is usefull to add more command without change of your bus configuration.

Install

Via Composer

$ composer require luri/tactician-container-auto

Usage

This plugin is based onto league/tactician-container. Documentation for tactician-container is available on the official website.

for autofind handler functionnality work, you must follow this name convention : Handler class must be named : {CommandClassName}Handler. And this class must be known of your PSR11 container.

For example : Command : AddTrampoline Command Handler : AddTrampolineHandler

Setup can be a little more simple than tactician-container : ( this example is adpated from official example](http://tactician.thephpleague.com/plugins/container/) )


// Create a new Tactician ContainerLocator, passing a fully configured container instance.
use Luri\Tactician\ContainerLocatorWithAutofind;
$containerLocator = new ContainerLocatorWithAutofind($container);

// Finally, we pass the ContainerLocator into the CommandHandlerMiddleware that
// we use in almost every CommandBus.
$commandHandlerMiddleware = new CommandHandlerMiddleware(
    new ClassNameExtractor(),
    $containerLocator,
    new HandleInflector()
)

// And that's it! Drop it in our command bus and away you go.
$commandBus = new CommandBus(
    [
        // your other middlewares...
        $commandHandlerMiddleware,
    ]
);

Testing

No test for now. To be continued...

Credits

Security

Disclosure information can be found on the main Tactician repo.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固