twc/bus-bundle

为 Symfony 4 提供实现消息总线概念的简单方法

安装: 235

依赖: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

v1.1.1 2021-07-16 06:21 UTC

This package is auto-updated.

Last update: 2024-09-16 13:07:35 UTC


README

为 Symfony 提供实现消息总线概念的简单方法。

开始之前

感谢 @lilobasePHP 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 中的依赖注入和自动装配。

示例