gember / event-sourcing-symfony-bundle
Symfony Bundle for Gember Event Sourcing (gember/event-sourcing)
Package info
github.com/GemberPHP/event-sourcing-symfony-bundle
Type:symfony-bundle
pkg:composer/gember/event-sourcing-symfony-bundle
Requires
- php: ^8.3
- ext-pcntl: *
- gember/event-sourcing: ^0.22
- gember/identity-generator-symfony: ^0.12
- gember/message-bus-symfony: ^0.12
- gember/rdbms-event-store-doctrine-dbal: ^0.21 || ^0.22
- gember/serializer-symfony: ^0.12
- symfony/config: ^7.1|^7.2|^8.0
- symfony/console: ^7.1|^7.2|^8.0
- symfony/dependency-injection: ^7.1|^7.2|^8.0
- symfony/event-dispatcher: ^7.1|^7.2|^8.0
- symfony/http-kernel: ^7.1|^7.2|^8.0
- symfony/property-access: ^7.1|^7.2|^8.0
Requires (Dev)
- captainhook/captainhook: ^5.23
- friendsofphp/php-cs-fixer: ^3.64
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.1
- rector/rector: ^2.0
- shipmonk/composer-dependency-analyser: ^1.7
- symfony/yaml: ^7.1|^7.2|^8.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- 0.24.0
- 0.23.2
- 0.23.1
- 0.23.0
- 0.22.1
- 0.22.0
- 0.21.0
- 0.20.0
- 0.19.0
- 0.18.0
- 0.17.0
- 0.16.0
- 0.15.2
- 0.15.1
- 0.15.0
- 0.14.0
- 0.13.1
- 0.13.0
- 0.12.0
- 0.11.0
- 0.10.0
- 0.9.0
- 0.8.0
- 0.7.0
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.1
- 0.3.0
- 0.2.0
- 0.1.0
- dev-add-build-badge
- dev-support-event-sourcing-0.22
- dev-readme-review
- dev-symfony-bundle-type
- dev-outbox-retry-backoff
This package is auto-updated.
Last update: 2026-11-01 19:58:19 UTC
README
Gember Event Sourcing Symfony Bundle for (gember/event-sourcing).
Installation
Install the Symfony Bundle with composer:
composer require gember/event-sourcing-symfony-bundle
Symfony Flex enables the bundle automatically. Without Flex, add it to config/bundles.php:
return [ // ... Gember\EventSourcingSymfonyBundle\GemberEventSourcingBundle::class => ['all' => true], ];
This package requires Symfony ^7.1 or ^8.0, and the PHP extension pcntl (for graceful shutdown of the outbox processor).
Configuration
This package installs Gember Event Sourcing with all required dependency adapters. Some of these adapters need to be configured.
By default, it uses the following configuration (gember_event_sourcing.yaml):
gember_event_sourcing: message_bus: symfony: event_bus: '@event.bus' command_bus: '@command.bus' cache: enabled: false psr6: service: '@cache.app' # Or set a PSR-16 compatible cache layer of your choice # psr16: # service: '@some.psr16.service' serializer: symfony: serializer: '@serializer' event_store: rdbms: doctrine_dbal: connection: '@doctrine.dbal.default_connection' generator: identity: # Use Gember alias of @Symfony\Component\Uid\Factory\UuidFactory: service: '@gember.identity_generator_symfony.uuid.symfony_uuid_identity_generator' # Or use Gember alias of @Symfony\Component\Uid\Factory\UlidFactory: # service: '@gember.identity_generator_symfony.ulid.symfony_ulid_identity_generator' registry: event: reflector: path: '%kernel.project_dir%/src' command_handler: reflector: path: '%kernel.project_dir%/src' saga: reflector: path: '%kernel.project_dir%/src' logging: logger: '@logger' snapshot: enabled: false # see the Snapshotting docs dispatch: strategy: direct # 'direct' or 'outbox', see the Outbox docs max_retries: 5 # outbox only
You can override any of these defaults however you like. See the documentation for caching, snapshotting and the outbox.
Use cases and sagas must be registered as autoconfigured services (the Symfony default for src/): their #[DomainCommandHandler] and #[SagaEventSubscriber] methods are routed to the message buses through autoconfiguration.
Required dependencies
Some of the required dependencies also need to be configured separately.
Symfony Messenger (symfony/messenger)
Two message buses are used: command.bus and event.bus. Events without handlers are normal, so allow them on the event bus:
# config/packages/messenger.yaml framework: messenger: default_bus: command.bus buses: command.bus: event.bus: default_middleware: allow_no_handlers: true
Other buses can be configured with message_bus.symfony.event_bus and command_bus; they must be services implementing Symfony\Component\Messenger\MessageBusInterface.
Symfony Cache (symfony/cache)
When caching is enabled, Gember Event Sourcing makes use of @cache.app by default.
This cache service is automatically configured when using Symfony framework including symfony/cache.
A different cache pool must be a service implementing Psr\Cache\CacheItemPoolInterface (PSR-6) or Psr\SimpleCache\CacheInterface (PSR-16).
Symfony Serializer (symfony/serializer)
Gember Event Sourcing makes use of @serializer.
This serializer service is automatically configured when using Symfony framework including symfony/serializer.
A different serializer must be a service implementing Symfony\Component\Serializer\SerializerInterface.
Doctrine DBAL (doctrine/doctrine-bundle)
Gember Event Sourcing makes use of @doctrine.dbal.default_connection, provided by doctrine/doctrine-bundle.
A different connection must be a service implementing Doctrine\DBAL\Connection.
Database
Events, sagas, snapshots and outbox messages are stored in MySQL, MariaDB (InnoDB) or SQLite. Create the tables with the migrations or schema of gember/rdbms-event-store-doctrine-dbal, and see Upgrading when upgrading.
Good to go!
Check the main package gember/event-sourcing or the demo application gember/example-event-sourcing-dcb for examples.