Vortos
Domain

Domain

The pure domain layer — aggregates, identities, domain events, value objects, and collections. No infrastructure dependencies.

Domain

vortos-domain is the pure domain layer. It has no dependencies on infrastructure — no Doctrine, no Redis, no HTTP. Everything in this package is plain PHP expressing business concepts.

Dependency Direction

Infrastructure depends on domain. Domain never depends on infrastructure. DbalStore and OrmStore depend on your repository interfaces. Those interfaces do not know Doctrine exists.

What's in vortos-domain

ComponentPurpose
AggregateRootBase class for all domain aggregates
AggregateIdType-safe UuidV7-based identity
DomainEventBase class for domain events
AbstractCommandBase class for CQRS commands
ValueObjectBase class for value objects
CollectionType-safe domain collections
WriteRepositoryInterfaceContract for write-side repositories
ReadRepositoryInterfaceContract for read-side repositories
PageResultCursor-based pagination result
DomainErrorStructured, typed domain failure with error code and context
Result<T>Explicit success/failure container — ok(), fail(), unwrap()
#[HttpStatus]Declares the HTTP status a DomainError maps to

The Aggregate Pattern

final class User extends AggregateRoot

UserId extends AggregateId

UserRegisteredEvent extends DomainEvent

Email extends ValueObject

Your domain model is built entirely from these building blocks. Infrastructure layers (DBAL, MongoDB) implement the interfaces — your domain code never imports them.

Module Overview

On this page