twc / bus-bundle
为 Symfony 4 提供实现消息总线概念的简单方法
v1.1.1
2021-07-16 06:21 UTC
Requires
- php: ^7.1
- symfony/dependency-injection: ^4.4|^5.3
- symfony/framework-bundle: ^4.4|^5.3
README
为 Symfony 提供实现消息总线概念的简单方法。
开始之前
感谢 @lilobase 在 PHP TOUR 2018 上的出色演讲。
感谢 @matGiWeb 使用 cqrs-skeleton
记住
CQRS (命令查询责任分离) 是一个旨在分离 写入(命令)和 读取(查询)的架构模式。
先决条件
symfony 强大的 DI(依赖注入)和 autowire(自动装配)功能已启用
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
public: false
安装
composer require twc/bus-bundle
如何使用?
如果你了解 CQRS 模式,你只需实现所需的接口即可
关于命令
关于事件
关于查询
关于总线
就是这样!
CommandBus、EventBus、QueryBus 会完成工作,感谢 symfony 中的依赖注入和自动装配。