PHPackages                             becklyn/ddd-symfony-bridge - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. becklyn/ddd-symfony-bridge

ActiveSymfony-bundle

becklyn/ddd-symfony-bridge
==========================

Symfony bridge for use with becklyn/ddd-core and becklyn/ddd-doctrine-bridge

5.2.0(9mo ago)06.9k↓35%2MITPHPPHP &gt;=8.0

Since Jul 22Pushed 9mo agoCompare

[ Source](https://github.com/Becklyn/ddd-symfony-bridge)[ Packagist](https://packagist.org/packages/becklyn/ddd-symfony-bridge)[ RSS](/packages/becklyn-ddd-symfony-bridge/feed)WikiDiscussions 4.0 Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (19)Used By (2)

becklyn/ddd-symfony-bridge integrates components provided by becklyn/ddd-core and becklyn/ddd-doctrine-bridge with a Symfony application. It uses SimpleBus to implement the event and command buses.

Installation
------------

[](#installation)

- Run `composer require becklyn/ddd-symfony-bridge`.
- Add the following to `bundles.php`:

```
SimpleBus\SymfonyBridge\SimpleBusCommandBusBundle::class => ['all' => true],
SimpleBus\SymfonyBridge\SimpleBusEventBusBundle::class => ['all' => true],
Becklyn\Ddd\BecklynDddBundle::class => ['all' => true],
```

### Enabling Event Bus &amp; Subscribers and Command Bus &amp; Handlers

[](#enabling-event-bus--subscribers-and-command-bus--handlers)

- Add the following to `services.yaml`:

```
event_subscribers:
    namespace: App\
    resource: '../src/**/*Subscriber.php'
    public: true
    tags:
        - { name: event_subscriber, register_public_methods: true }

command_handlers:
    namespace: App\
    resource: '../src/**/*Handler.php'
    public: true
    tags:
        - { name: command_handler, register_public_methods: true }
```

- The above registers all classes ending in 'Subscriber' as event subscribers, and all classes ending in 'Handler' as command handlers. Make sure you have no classes in your code with those endings that are not intended to be event subscribers or command handlers.

### Enabling the Event Store

[](#enabling-the-event-store)

- Run `php bin/console doctrine:migrations:migrate`. This executes the Doctrine migration provided by becklyn/ddd-doctrine-bridge to create database tables for the event store.
- If you do not wish to use the event store, see the `use_event_store` configuration option below.
- Add the following to `services.yaml` if you work with enums and need them to be serialized correctly

```
# services.yaml
    # required for serializing event data with enums into the event store
    symfony_enum_normalizer:
        class: Symfony\Component\Serializer\Normalizer\BackedEnumNormalizer
        public: false
        tags: [ serializer.normalizer ]
```

- Add the following to `services.yaml` to enable persisting event data in the event store

```
# services.yaml
    # required for serializing event data into the event store
    symfony_property_normalizer:
        class: Symfony\Component\Serializer\Normalizer\PropertyNormalizer
        public: false
        tags: [ serializer.normalizer ]
```

- Add the following to `services.yaml` and `doctrine.yaml` if you wish for Doctrine ORM to persist microseconds as part of domain event timestamps in the event store (should not be required for MySQL and Doctrine 3):

```
# services.yaml
    # required for microsecond serialization in event store for raisedTs
    datetime_normalizer:
        class: Symfony\Component\Serializer\Normalizer\DateTimeNormalizer
        public: false
        tags: [serializer.normalizer]
        arguments:
            -
                datetime_format: 'Y-m-d H:i:s.u'

    # only if using Oracle
    oracle_connector:
        class: Becklyn\Ddd\DateTime\Infrastructure\Doctrine\MicrosecondsOracleSessionInit
        tags:
            - { name: doctrine.event_listener, event: postConnect }

# doctrine.yaml
    # required for writing event raisedTs microseconds into the DB
    doctrine:
        dbal:
            types:
                datetime_immutable: Becklyn\Ddd\DateTime\Infrastructure\Doctrine\DateTimeImmutableMicrosecondsType
```

How To
------

[](#how-to)

### Use Event Subscribers and Command Handlers

[](#use-event-subscribers-and-command-handlers)

If you followed the installation instructions above, the only thing you need to register a class as an event subscriber or command handler is to have its class name end in 'Subscriber' or 'Handler', respectively.

Each subscriber or handler may handle one or more events or commands. An individual event class may be handled by multiple subscribers, while the application will throw exceptions or behave unpredictably if a command class is handled by multiple handlers.

To have a subscriber or handler handle an event or command, simply implement a public method with a single argument typed to the event or command class. The name of the method and the argument can be anything, but the method must return void. It is traditional for the method to be named `handle` and the argument `$event` or `$command`, or for methods to be named `handleMyEventClass` in case of subscribers or handlers handling multiple different events or commands.

Configuration
-------------

[](#configuration)

To change the values of configuration options from their defaults, create a `becklyn_ddd.yaml` file in the `config/packages` folder within your Symfony application with the following contents:

```
becklyn_ddd:
    option_name: value
    another_option_name: value
```

### Available Options

[](#available-options)

#### use\_event\_store

[](#use_event_store)

- Type: boolean
- Default: true

By default, the event store is active. If you do not want to use it for whatever reason, set this option to false.

Note that if you leave this option set to true and do not execute the Doctrine migrations required for the store, the application will throw an exception as soon as a transaction is committed and there have been events registered.

SimpleBus Configuration
-----------------------

[](#simplebus-configuration)

SimpleBus always finishes the handling of the current command before new commands dispatched during this handling are processed. In other words, it puts all commands dispatched during the processing of another command into a queue, and flushes the queue only when the processing of the current command is complete.

Having a command dispatch another command and that new command be processed before handling of the originating command resumes can be a code smell in a lot of situations. But in case you require such functionality it is possible to configure SimpleBus to do so. Add the following to the `command_bus.yaml` in `config/packages`:

```
command_bus:
    middlewares:
        finishes_command_before_handling_next: false
```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance56

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 73.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~91 days

Recently: every ~265 days

Total

17

Last Release

294d ago

Major Versions

1.x-dev → 2.0.02021-07-22

2.x-dev → 3.0.02022-08-24

3.x-dev → 4.0.02022-08-25

4.0.x-dev → 5.0.x-dev2025-07-29

PHP version history (2 changes)1.0.0PHP &gt;=7.4

2.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1044355?v=4)[Becklyn Studios](/maintainers/becklyn)[@Becklyn](https://github.com/Becklyn)

---

Top Contributors

[![msvujnovic-becklyn](https://avatars.githubusercontent.com/u/74408165?v=4)](https://github.com/msvujnovic-becklyn "msvujnovic-becklyn (14 commits)")[![glassp](https://avatars.githubusercontent.com/u/24590561?v=4)](https://github.com/glassp "glassp (2 commits)")[![Thyrannoizer](https://avatars.githubusercontent.com/u/29758676?v=4)](https://github.com/Thyrannoizer "Thyrannoizer (2 commits)")[![msvujnovic](https://avatars.githubusercontent.com/u/22997161?v=4)](https://github.com/msvujnovic "msvujnovic (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/becklyn-ddd-symfony-bridge/health.svg)

```
[![Health](https://phpackages.com/badges/becklyn-ddd-symfony-bridge/health.svg)](https://phpackages.com/packages/becklyn-ddd-symfony-bridge)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
