open-solid / core
Building Blocks for Modular Architecture with Symfony
v0.2.8
2026-03-27 15:00 UTC
Requires
- php: >=8.4
- open-solid/bus: ^1.1
- symfony/uid: ^7.0|^8.0
Requires (Dev)
- doctrine/doctrine-bundle: ^3.1
- doctrine/orm: ^3.5
- friendsofphp/php-cs-fixer: ^3.91
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.5
- symfony/framework-bundle: ^8.0
- symfony/messenger: ^8.0
README
Building blocks for modular architecture with Symfony.
Provides DDD-oriented abstractions ─ commands, queries, domain events, error handling, collections, and a convention-based module system ─ so you can focus on your domain logic instead of wiring infrastructure.
Installation
composer require open-solid/core
The bundle is auto-registered via Symfony Flex.
Modular Application Structure
Each bounded context lives in its own module with the same layered structure:
src/ ├── Product/ # Module root │ ├── Application/ │ │ └── Product/ # Aggregate │ │ ├── Create/ # Use case (verb) │ │ │ ├── CreateProduct.php # Command │ │ │ └── CreateProductHandler.php # Handler │ │ └── Find/ │ │ ├── FindProduct.php # Query │ │ └── FindProductHandler.php # Handler │ ├── Domain/ │ │ ├── Error/ # Domain-specific errors │ │ ├── Event/ # Domain events │ │ └── Model/ # Aggregate, entities and value objects │ │ └── Product.php │ └── Infrastructure/ │ ├── Resources/ │ │ └── config/ │ │ ├── doctrine/ │ │ │ └── mapping/ # Doctrine ORM mappings │ │ ├── packages/ # Package-specific config overrides │ │ └── services.yaml # Service definitions │ └── ProductExtension.php # Module extension │ ├── Order/ # Another module │ ├── Application/ │ ├── Domain/ │ └── Infrastructure/ │ └── OrderExtension.php │ └── Kernel.php
Each ModuleExtension automatically registers services, and Doctrine mappings for its module ─ zero manual wiring.
Documentation
- Configuration ─ Bus strategies, Doctrine ORM mapping, and API Platform resource settings.
- Commands & Queries (CQS) ─ Type-safe command-query separation with auto-discovered handlers.
- Domain Events ─ Raise and react to events with automatic publishing after command execution.
- Error Handling ─ Structured domain errors with factory methods and batch error accumulation.
- Collections ─ Domain repository abstractions built on top of Doctrine Collections.
- Modular Architecture ─ Convention-based module system with automatic service registration.