|
4 | 4 |
|
5 | 5 | Gember Event Sourcing Symfony Bundle for ([gember/event-sourcing](https://github.com/GemberPHP/event-sourcing)). |
6 | 6 |
|
7 | | -## Prerequisites |
8 | | -This package requires Symfony `^7.1`. |
| 7 | +## Installation |
| 8 | +Install the Symfony Bundle with composer: |
| 9 | + |
| 10 | +```bash |
| 11 | +composer require gember/event-sourcing-symfony-bundle |
| 12 | +``` |
9 | 13 |
|
10 | | -Several additional packages should be installed and configured in Symfony as well: |
| 14 | +This package requires Symfony `^7.1`. |
11 | 15 |
|
12 | | -#### Symfony Messenger (`symfony/messenger`) |
13 | | -At least one message bus should be configured, with the name `@event.bus`. |
| 16 | +## Configuration |
| 17 | +This package installs _Gember Event Sourcing_ with all required dependency adapters. |
| 18 | +Some of these adapters need to be configured. |
14 | 19 |
|
15 | | -When this bus is configured, Gember Event Sourcing works out of the box. |
16 | | -However, when a different event bus is preferred, it can be overwritten by configuration (`gember_event_sourcing.yaml`). |
| 20 | +By default, it uses the following configuration (`gember_event_sourcing.yaml`): |
17 | 21 | ```yaml |
18 | 22 | gember_event_sourcing: |
19 | 23 | message_bus: |
20 | 24 | symfony: |
21 | 25 | event_bus: '@event.bus' |
22 | | -``` |
23 | | -Note: It must be a service implementing `Symfony\Component\Messenger\MessageBusInterface`. |
24 | | - |
25 | | -#### Symfony Cache (`symfony/cache`) |
26 | | -Gember Event Sourcing makes use of `@cache.app`. |
27 | | -This cache service is automatically configured when using Symfony framework including `symfony/cache`. |
28 | | - |
29 | | -When this cache service is configured, Gember Event Sourcing works out of the box. |
30 | | -However, when a different cache pool is preferred, it can be overwritten by configuration (`gember_event_sourcing.yaml`): |
31 | | -```yaml |
32 | | -gember_event_sourcing: |
33 | 26 | cache: |
34 | 27 | enabled: true |
35 | 28 | psr6: '@cache.app' |
36 | | - |
| 29 | + |
37 | 30 | # Or set a PSR-16 compatible cache layer of your choice |
38 | 31 | # psr16: '@some.psr16.service' |
39 | | -``` |
40 | | -Note: It must be a service implementing `Psr\Cache\CacheItemPoolInterface` (PSR-6) or `Psr\SimpleCache\CacheInterface` (PSR-16). |
41 | | - |
42 | | -#### Symfony Serializer (`symfony/serializer`) |
43 | | -Gember Event Sourcing makes use of `@serializer`. |
44 | | -This serializer service is automatically configured when using Symfony framework including `symfony/serializer`. |
45 | | - |
46 | | -When this serializer service is configured, Gember Event Sourcing works out of the box. |
47 | | -However, when a different serializer is preferred, it can be overwritten by configuration (`gember_event_sourcing.yaml`): |
48 | | -```yaml |
49 | | -gember_event_sourcing: |
50 | 32 | serializer: |
51 | 33 | symfony: |
52 | | - serializer: '@serializer' |
| 34 | + serializer: '@serializer' |
| 35 | + event_store: |
| 36 | + rdbms: |
| 37 | + doctrine_dbal: |
| 38 | + connection: '@doctrine.dbal.default_connection' |
| 39 | + generator: |
| 40 | + identity: |
| 41 | + # Use Gember alias of @Symfony\Component\Uid\Factory\UuidFactory: |
| 42 | + service: '@gember.identity_generator_symfony.uuid.symfony_uuid_identity_generator' |
| 43 | + |
| 44 | + # Or use Gember alias of @Symfony\Component\Uid\Factory\UlidFactory: |
| 45 | + # service: '@gember.identity_generator_symfony.ulid.symfony_ulid_identity_generator' |
| 46 | + registry: |
| 47 | + event_registry: |
| 48 | + reflector: |
| 49 | + path: '%kernel.project_dir%/src' |
53 | 50 | ``` |
54 | | -Note: It must be a service implementing `Symfony\Component\Serializer\SerializerInterface`. |
55 | 51 |
|
56 | | -#### Doctrine DBAL/ORM (`doctrine/dbal`, `doctrine/orm`) |
57 | | -Gember Event Sourcing makes use of `@doctrine.dbal.default_connection`. |
58 | | -This connection service is automatically configured when using Symfony framework including `doctrine/dbal` or `doctrine/orm`. |
| 52 | +You can override any of these defaults however you like. |
59 | 53 |
|
60 | | -When this connection service is configured, Gember Event Sourcing works out of the box. |
61 | | -However, when a different Doctrine connection is preferred, it can be overwritten by configuration (`gember_event_sourcing.yaml`): |
62 | | -```yaml |
63 | | -gember_event_sourcing: |
64 | | - event_store: |
65 | | - rdbms: |
66 | | - doctrine_dbal: |
67 | | - connection: '@doctrine.dbal.default_connection' |
68 | | -``` |
69 | | -Note: It must be a service implementing `Doctrine\DBAL\Connection`. |
| 54 | +## Required dependencies |
| 55 | +Some of the required dependencies also need to be configured separately. |
70 | 56 |
|
71 | | -#### Symfony UID (`symfony/uid`) |
72 | | -Gember Event Sourcing makes use of `@Symfony\Component\Uid\Factory\UuidFactory` or `Symfony\Component\Uid\Factory\UlidFactory`. |
| 57 | +### Symfony Messenger (`symfony/messenger`) |
| 58 | +At least one message bus should be configured, with the name `@event.bus`. |
73 | 59 |
|
74 | | -These factories are automatically configured when using Symfony framework including `symfony/uid`. |
| 60 | +When this bus is configured, _Gember Event Sourcing_ works out of the box. |
| 61 | +However, when a different event bus is preferred, it must be a service implementing `Symfony\Component\Messenger\MessageBusInterface`. |
75 | 62 |
|
76 | | -By default, the UUID factory is used in Gember Event Sourcing. |
77 | | -However, if the ULID factory is preferred, it can be overwritten by configuration (`gember_event_sourcing.yaml`): |
78 | | -```yaml |
79 | | -gember_event_sourcing: |
80 | | - generator: |
81 | | - identity: |
82 | | - # Use Gember alias of @Symfony\Component\Uid\Factory\UuidFactory: |
83 | | - service: '@gember.identity_generator_symfony.uuid.symfony_uuid_identity_generator' |
| 63 | +### Symfony Cache (`symfony/cache`) |
| 64 | +_Gember Event Sourcing_ makes use of `@cache.app`. |
| 65 | +This cache service is automatically configured when using Symfony framework including `symfony/cache`. |
84 | 66 |
|
85 | | - # Or use Gember alias of @Symfony\Component\Uid\Factory\UlidFactory: |
86 | | - # service: '@gember.identity_generator_symfony.ulid.symfony_ulid_identity_generator' |
87 | | -``` |
| 67 | +When this cache service is configured, _Gember Event Sourcing_ works out of the box. |
| 68 | +However, when a different cache pool is preferred, it must be a service implementing `Psr\Cache\CacheItemPoolInterface` (PSR-6) or `Psr\SimpleCache\CacheInterface` (PSR-16). |
88 | 69 |
|
89 | | -## Installation |
90 | | -When all prerequisites are met, it's time to install the bundle package itself: |
| 70 | +### Symfony Serializer (`symfony/serializer`) |
| 71 | +_Gember Event Sourcing_ makes use of `@serializer`. |
| 72 | +This serializer service is automatically configured when using Symfony framework including `symfony/serializer`. |
91 | 73 |
|
92 | | -```bash |
93 | | -composer require gember/event-sourcing-symfony-bundle |
94 | | -``` |
| 74 | +When this serializer service is configured, _Gember Event Sourcing_ works out of the box. |
| 75 | +However, when a different serializer is preferred, it must be a service implementing `Symfony\Component\Serializer\SerializerInterface`. |
| 76 | + |
| 77 | +### Doctrine DBAL/ORM (`doctrine/dbal`, `doctrine/orm`) |
| 78 | +_Gember Event Sourcing_ makes use of `@doctrine.dbal.default_connection`. |
| 79 | +This connection service is automatically configured when using Symfony framework including `doctrine/dbal` or `doctrine/orm`. |
| 80 | + |
| 81 | +When this connection service is configured, _Gember Event Sourcing_ works out of the box. |
| 82 | +However, when a different Doctrine connection is preferred, it must be a service implementing `Doctrine\DBAL\Connection`. |
95 | 83 |
|
96 | 84 | ## Database |
97 | 85 | In order to persist all domain events in database, a running SQL database is needed. |
|
0 commit comments