Skip to content

Repository files navigation

OpenSolid Core

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.

PHP 8.4+Symfony 7/8

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.

About

Building Blocks for Modular Architecture with Symfony

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages