How alexandrebulete/ddd-foundation works
DDD Foundation is a pure PHP library of reusable domain and application building blocks, not a standalone service. A project defines commands/queries and handlers; query handlers configure repository operations, while domain value objects, events, criteria, and repository contracts support that work. The included in-memory repository provides a test-double implementation with filtering, sorting, and pagination. README capabilities such as authorization, activity journaling, and selectable enums are represented as documented branches; their runtime connections are not shown in the excerpts.
Main entry points: RepositoryInterface.php Repository contract · QueryInterface.php Query contracts · QueryCollectionHandler.php Collection handler · QuerySingleHandler.php Single handler
Components 24
Application
- Command contracts
src/Application/Command/CommandInterface.php - Command handlers
src/Application/Command/AsCommandHandler.php - Command bus
src/Application/Command/CommandBusInterface.php - Query contracts
src/Application/Query/QueryInterface.php - Query handler markers
src/Application/Query/AsQueryHandler.php - Query bus
src/Application/Query/QueryBusInterface.php - Collection handler
src/Application/Handler/QueryCollectionHandler.php - Single handler
src/Application/Handler/QuerySingleHandler.php - Criteria builder
src/Application/Criteria/CriteriaBuilder.php - Criteria normalizer
src/Application/Criteria/CriteriaNormalizer.php - Authorization
src/Application/Authorization/Permission.php - Activity journaling
src/Application/Activity/ActivityDescription.php - Event dispatcher contract
src/Application/Event/EventDispatcherInterface.php
Domain
- Domain events
src/Domain/Event/DomainEvent.php - Event recording
src/Domain/Model/RecordsEvents.php - Repository contract
src/Domain/Repository/RepositoryInterface.php - Comparison vocabulary
src/Domain/Repository/Comparison.php - Paginator contract
src/Domain/Repository/PaginatorInterface.php - Not-found exception
src/Domain/Exception/EntityNotFoundException.php - Value objects
src/Domain/ValueObject/IdentifierVO.php - Selectable enums
src/Domain/Trait/AsSelectableEnum.php
In-memory infrastructure
- In-memory repository
src/Infrastructure/InMemory/InMemoryRepository.php - In-memory paginator
src/Infrastructure/InMemory/InMemoryPaginator.php
Other components
- DDD project
Connections 28
- DDD project → Command contracts: defines commands
README.md - DDD project → Command handlers: implements handlers
README.md - DDD project → Query contracts: defines queries
README.md - DDD project → Query handler markers: marks handlers
README.md - DDD project → Criteria builder: builds criteria
README.md - DDD project → Authorization: uses permissions
README.md - DDD project → Activity journaling: journals activity
README.md - DDD project → Event dispatcher contract: dispatches events
src/Application/Event/EventDispatcherInterface.php - DDD project → Selectable enums: selects enum choices
README.md - Command handlers → Command contracts: handles
README.md - Command bus → Command contracts: dispatches
src/Application/Command/CommandBusInterface.php - Query bus → Query contracts: asks
src/Application/Query/QueryBusInterface.php - Collection handler → Query contracts: reads query
src/Application/Handler/QueryCollectionHandler.php - Single handler → Query contracts: reads query
src/Application/Handler/QuerySingleHandler.php - Collection handler → Criteria normalizer: normalizes criteria
src/Application/Handler/QueryCollectionHandler.php - Collection handler → Repository contract: configures repository
src/Application/Handler/QueryCollectionHandler.php - Single handler → Repository contract: finds entity
src/Application/Handler/QuerySingleHandler.php - Single handler → Not-found exception: throws when absent
src/Application/Handler/QuerySingleHandler.php - Criteria builder → Comparison vocabulary: uses vocabulary
src/Application/Criteria/CriteriaBuilder.php - Criteria normalizer → Comparison vocabulary: uses vocabulary
src/Application/Criteria/CriteriaNormalizer.php - Event recording → Domain events: records events
src/Domain/Model/RecordsEvents.php - Event dispatcher contract → Domain events: dispatches
src/Application/Event/EventDispatcherInterface.php - Repository contract → Paginator contract: returns paginator
src/Domain/Repository/RepositoryInterface.php - Repository contract → Value objects: looks up identifier
src/Domain/Repository/RepositoryInterface.php - In-memory repository → Repository contract: implements
src/Infrastructure/InMemory/InMemoryRepository.php - In-memory repository → Comparison vocabulary: parses filters
src/Infrastructure/InMemory/InMemoryRepository.php - In-memory repository → In-memory paginator: creates paginator
src/Infrastructure/InMemory/InMemoryRepository.php - In-memory paginator → Paginator contract: implements
src/Infrastructure/InMemory/InMemoryPaginator.php