This project is a template for a DDD-based Modulith. It uses Symfony and is fully Docker-compatible and can be executed directly with
docker compose up. The modules are integrated via IntegrationEvents, which can be found in the extra Integration
directory.
A rudimentary library application was implemented to illustrate this. This contains the two BoundedContexts Search and
Loan. Books can be added to Search, which then appear as a publication in Loan. Real books can then be purchased
and borrowed in Loan.
Some useful commands for controlling the application and development are listed below.
Build images
docker compose buildStart application
docker compose upInstall dependencies
docker compose exec -T php composer installExecute messages interactive
docker compose exec -iT php bin/console messenger:consumeStop application
docker compose downGenerate migration
docker compose exec -T php bin/console doctrine:migrations:diff --em=<EntityManager>The database migrations are carried out automatically when the application is started
Debugging
- Start application in xDebug-Mode
XDEBUG_MODE=debug docker compose up -d
- In the
Settings/Preferencesdialog, go toPHP | Servers - Create a new server:
- Name:
symfony(or whatever you want to use for the variablePHP_IDE_CONFIG) - Host:
localhost(or the one defined using theSERVER_NAMEenvironment variable) - Port:
443 - Debugger:
Xdebug - Check
Use path mappings - Absolute path on the server:
/app
- Name:
- In PHPStorm, open the
Runmenu and click onStart Listening for PHP Debug Connections - Add the
?XDEBUG_SESSION=PHPSTORMquery parameter to the URL of the page you want to debug.
Update the containerization-template
-
Run the script to synchronize your project with the latest version of the skeleton:
curl -sSL https://raw.githubusercontent.com/mano-lis/template-sync/main/template-sync.sh | sh -s -- https://github.com/dunglas/symfony-docker -
Resolve conflicts, if any
-
Run
git cherry-pick --continue