Skip to content

Commit d767afa

Browse files
author
Jeroen de Graaf
committed
Setup prerequisites
1 parent 8c9e16e commit d767afa

File tree

1 file changed

+94
-1
lines changed

1 file changed

+94
-1
lines changed

README.md

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,97 @@
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 Event Sourcing Symfony Bundle for ([gember/event-sourcing](https://github.com/GemberPHP/event-sourcing)).
5+
Gember Event Sourcing Symfony Bundle for ([gember/event-sourcing](https://github.com/GemberPHP/event-sourcing)).
6+
7+
## Prerequisites
8+
This package requires Symfony `^7.1`.
9+
10+
Several additional packages should be installed and configured in Symfony as well:
11+
12+
#### Symfony Messenger (`symfony/messenger`)
13+
At least one message bus should be configured, with the name `@event.bus`.
14+
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`).
17+
```yaml
18+
gember_event_sourcing:
19+
message_bus:
20+
symfony:
21+
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+
cache:
34+
enabled: true
35+
psr6: '@cache.app'
36+
37+
# Or set a PSR-16 compatible cache layer of your choice
38+
# 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+
serializer:
51+
symfony:
52+
serializer: '@serializer'
53+
```
54+
Note: It must be a service implementing `Symfony\Component\Serializer\SerializerInterface`.
55+
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`.
59+
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`.
70+
71+
#### Symfony UID (`symfony/uid`)
72+
Gember Event Sourcing makes use of `@Symfony\Component\Uid\Factory\UuidFactory` or `Symfony\Component\Uid\Factory\UlidFactory`.
73+
74+
These factories are automatically configured when using Symfony framework including `symfony/uid`.
75+
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'
84+
85+
# Or use Gember alias of @Symfony\Component\Uid\Factory\UlidFactory:
86+
# service: '@gember.identity_generator_symfony.ulid.symfony_ulid_identity_generator'
87+
```
88+
89+
## Installation
90+
When all prerequisites are met, it's time to install the bundle package itself:
91+
92+
```bash
93+
composer require gember/event-sourcing-symfony-bundle
94+
```
95+
96+
## Good to go!
97+
Check the main package [gember/event-sourcing](https://github.com/GemberPHP/event-sourcing) or
98+
the demo application [gember/example-event-sourcing-dcb](https://github.com/GemberPHP/example-event-sourcing-dcb) for examples.

0 commit comments

Comments
 (0)