https://github.com/thewalkingcoder/twcbusbundle
Provide simple way to implement Message Bus concept in Symfony 4
https://github.com/thewalkingcoder/twcbusbundle
bus cqrs symfony
Last synced: 28 days ago
JSON representation
Provide simple way to implement Message Bus concept in Symfony 4
- Host: GitHub
- URL: https://github.com/thewalkingcoder/twcbusbundle
- Owner: thewalkingcoder
- Created: 2019-08-14T12:14:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-05-15T08:57:21.000Z (11 months ago)
- Last Synced: 2025-07-15T12:39:20.715Z (9 months ago)
- Topics: bus, cqrs, symfony
- Language: PHP
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TwcBusBundle
Provide simple way to implement Message Bus concept in Symfony.
## Before start
Thank's [@lilobase](https://twitter.com/Lilobase) for you excellent talk at [PHP TOUR 2018](https://afup.org/talks/2628-cqrs-fonctionnel-event-sourcing-domain-driven-design).
Thank's [@matGiWeb](https://twitter.com/matGiWeb) for you approach with [cqrs-skeleton](https://github.com/magi-web/cqrs-skeleton)
## Remember
CQRS (Command Query Responsibility Segregation) it's an architectural pattern that aims to separate the **writing** (Command) and **reading** (Query).
## Pré-requis
symfony powerfull DI with autowire and autoconfigure enable
```
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
```
## Installation
```
composer require twc/bus-bundle
```
## How to use ?
If you know CQRS pattern, you only have to implement the desired interface
### About Commands
| topic | Interface |
|--------|-----------|
| Command | Twc\BusBundle\Command\Interfaces\Command |
| CommandHandler | Twc\BusBundle\Command\Interfaces\CommandHandler |
| Middleware | Twc\BusBundle\Command\Interfaces\CommandBusMiddleware |
### About Events
| topic | Interface |
|--------|-----------|
| Event | Twc\BusBundle\Event\Interfaces\Event |
| EventHandler | Twc\BusBundle\Event\Interfaces\EventHandler |
### About Queries
| topic | Interface |
|--------|-----------|
| Query | Twc\BusBundle\Query\Interfaces\Query |
| QueryHandler | Twc\BusBundle\Event\Interfaces\QueryHandler |
## About Bus
| topic | Interface |
|--------|-----------|
| CommandBusDispatcher | Twc\BusBundle\Command\CommandBusDispatcher |
| EventBusDispatcher | Twc\BusBundle\Event\EventBusDispatcher |
| QueryBusDispatcher | Twc\BusBundle\Query\QueryBusDispatcher |
That's all !
CommandBus, EventBus, QueryBus will do the work, thank's Dependencies Injection and autowiring in symfony.
# Samples
- [exemple (fr)](./docs/cqrs_fr.md)