jorge07/symfony-7-es-cqrs-boilerplate

Symfony 7 DDD ES CQRS backend boilerplate.

PHP

1,087

381 commits

updated Aug 9, 2026

See the code

README

Symfony 7 ES CQRS Boilerplate

All Contributors

A boilerplate demonstrating Domain-Driven Design (DDD), Command Query Responsibility Segregation (CQRS), and Event Sourcing patterns using Symfony 7 and PHP 8.3.

push

This is a long living repository that started at v4 and was upgraded to each major version since then. You can find older versions at the following branches:

symfony-6 branch

symfony-5 branch

symfony-4 branch

Documentation

Architecture

Architecture

Implementations

  • Environment in Docker
  • Symfony Messenger
  • Event Store
  • Read Model
  • Async Event subscribers
  • Rest API
  • Web UI (A Terrible UX/UI)
  • Event Store Rest API
  • Swagger API Doc

Use Cases

User

  • Sign up
  • Change Email
  • Sign in
  • Logout

API Doc

Stack

  • PHP 8.3
  • Symfony 7
  • MySQL 8.0
  • Elasticsearch & Kibana 7.11.0
  • RabbitMQ 3

Project Setup

ActionCommand
Setupmake start
Run Testsmake phpunit
Static Analysismake phpstan
Code Stylemake cs
PHP Shellmake s=php sh
Xdebugmake xoff/xon
Build Artifactsmake artifact

PHPStorm integration

PHPSTORM has native integration with Docker compose. That's nice but will stop your php container after run the test scenario. That's not nice when using fpm. A solution could be use another container just for that purpose but is way slower and I don't want. For that reason I use ssh connection.

IMPORTANT

ssh in the container it's ONLY for that reason and ONLY in the DEV TAG, if you've ssh installed in your production container, you're doing it wrong...*

Click here for the detailed instructions about how to setup the PHP remote interpreter in PHPStorm.

If you're already familiar with it, here a quick configuration reference:

HostDirection
Docker 4 maclocalhost
Dinghy$ dinghy ip

Port: 2323

Filesystem mapping: {PROJECT_PATH} -> /app

Xdebug

To ease your development process, you can use Xdebug with PHPSTORM.

  1. Add a Docker interpreter

    Docker PHP interpreter

  2. Enable Xdebug listenning. Don't forget to also activate Xdebug helper from your browser.

    Xdebug activation

    Additionally, you can check Break at first line in PHP scripts to ensure your debug is working.

  3. Make a request from you API at http://127.0.0.1/api/doc for example. You should see this popup:

    Xdebug mapping

    Click on Accept and you should be ready to debug ! Start placing breakpoints on your code and enjoy debugging !

Note for Windows users:

You might need to update docker-os= to docker-os=windows in Makefile or specify its value on command line like $ make start docker-os=windows.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

backend
cqrs
cqrs-es
ddd
docker
event-sourcing
hacktoberfest
symfony
symfony-flex

jorge07/symfony-7-es-cqrs-boilerplate

Symfony 7 DDD ES CQRS backend boilerplate.

PHP

1,087

381 commits

updated Aug 9, 2026

See the code

README

Symfony 7 ES CQRS Boilerplate

All Contributors

A boilerplate demonstrating Domain-Driven Design (DDD), Command Query Responsibility Segregation (CQRS), and Event Sourcing patterns using Symfony 7 and PHP 8.3.

push

This is a long living repository that started at v4 and was upgraded to each major version since then. You can find older versions at the following branches:

symfony-6 branch

symfony-5 branch

symfony-4 branch

Documentation

Architecture

Architecture

Implementations

  • Environment in Docker
  • Symfony Messenger
  • Event Store
  • Read Model
  • Async Event subscribers
  • Rest API
  • Web UI (A Terrible UX/UI)
  • Event Store Rest API
  • Swagger API Doc

Use Cases

User

  • Sign up
  • Change Email
  • Sign in
  • Logout

API Doc

Stack

  • PHP 8.3
  • Symfony 7
  • MySQL 8.0
  • Elasticsearch & Kibana 7.11.0
  • RabbitMQ 3

Project Setup

ActionCommand
Setupmake start
Run Testsmake phpunit
Static Analysismake phpstan
Code Stylemake cs
PHP Shellmake s=php sh
Xdebugmake xoff/xon
Build Artifactsmake artifact

PHPStorm integration

PHPSTORM has native integration with Docker compose. That's nice but will stop your php container after run the test scenario. That's not nice when using fpm. A solution could be use another container just for that purpose but is way slower and I don't want. For that reason I use ssh connection.

IMPORTANT

ssh in the container it's ONLY for that reason and ONLY in the DEV TAG, if you've ssh installed in your production container, you're doing it wrong...*

Click here for the detailed instructions about how to setup the PHP remote interpreter in PHPStorm.

If you're already familiar with it, here a quick configuration reference:

HostDirection
Docker 4 maclocalhost
Dinghy$ dinghy ip

Port: 2323

Filesystem mapping: {PROJECT_PATH} -> /app

Xdebug

To ease your development process, you can use Xdebug with PHPSTORM.

  1. Add a Docker interpreter

    Docker PHP interpreter

  2. Enable Xdebug listenning. Don't forget to also activate Xdebug helper from your browser.

    Xdebug activation

    Additionally, you can check Break at first line in PHP scripts to ensure your debug is working.

  3. Make a request from you API at http://127.0.0.1/api/doc for example. You should see this popup:

    Xdebug mapping

    Click on Accept and you should be ready to debug ! Start placing breakpoints on your code and enjoy debugging !

Note for Windows users:

You might need to update docker-os= to docker-os=windows in Makefile or specify its value on command line like $ make start docker-os=windows.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

backend
cqrs
cqrs-es
ddd
docker
event-sourcing
hacktoberfest
symfony
symfony-flex

Significant stargazers

Martins Sipenko

28 followers · starred Oct 2018

Yvan

16 followers · starred Jul 2019

Hugo Fonseca

36 followers · starred Feb 2019