Skip to content

Commit 4835bca

Browse files
committed
Update readme with installation and configuration details
1 parent cf74a13 commit 4835bca

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed

README.md

+46-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,49 @@
1-
# 🫚 Gember MessageBus: Symfony Messenger
1+
# 🫚 Gember Message Bus: Symfony Messenger
22
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE)
33
[![PHP Version](https://img.shields.io/badge/php-%5E8.3-8892BF.svg?style=flat)](http://www.php.net)
44

5-
Gember MessageBus ([gember/event-sourcing](https://github.com/GemberPHP/event-sourcing)) implementation based on [symfony/messenger](https://github.com/symfony/messenger).
5+
[Gember Event Sourcing](https://github.com/GemberPHP/event-sourcing) Message Bus adapter based on [symfony/messenger](https://github.com/symfony/messenger).
6+
7+
> All external dependencies in Gember Event Sourcing are organized into separate packages,
8+
> making it easy to swap out a vendor adapter for another.
9+
10+
## Installation
11+
Install with Composer:
12+
```bash
13+
composer gember/message-bus-symfony
14+
```
15+
16+
## Configuration
17+
Bind this adapter to the `EventBus` interface in your service definitions.
18+
19+
### Examples
20+
21+
#### Vanilla PHP
22+
```php
23+
use Gember\MessageBusSymfony\SymfonyEventBus;
24+
use Symfony\Component\Messenger\Handler\HandlersLocator;
25+
use Symfony\Component\Messenger\MessageBus;
26+
use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware;
27+
28+
$finder = new SymfonyEventBus(
29+
new MessageBus([ // An EventBus configuration of your choice
30+
new HandleMessageMiddleware(new HandlersLocator([
31+
SomeEvent::class => [SomeEventSubscriber::class],
32+
// ...
33+
])),
34+
]),
35+
);
36+
```
37+
38+
#### Symfony
39+
It is recommended to use the [Symfony bundle](https://github.com/GemberPHP/event-sourcing-symfony-bundle) to configure Gember Event Sourcing.
40+
With this bundle, the adapter is automatically set as the default for Event Bus.
41+
42+
If you're not using the bundle, you can bind it directly to the `EventBus` interface.
43+
44+
```yaml
45+
Gember\EventSourcing\Util\Messaging\MessageBus\EventBus:
46+
class: Gember\MessageBusSymfony\SymfonyEventBus
47+
arguments:
48+
- '@event.bus' # or any other defined Symfony event bus
49+
```

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gember/message-bus-symfony",
3-
"description": "Gember MessageBus (gember/event-sourcing) implementation based on symfony/messenger",
3+
"description": "Gember Event Sourcing Message Bus adapter based on symfony/messenger",
44
"license": "MIT",
55
"type": "library",
66
"keywords": [

0 commit comments

Comments
 (0)