| Aggregate Root |
An entity that serves as the entry point to a cluster of related objects. It has a repository interface and enforces invariants across its children. Example: Album is an aggregate root — it manages its own fields and rules. |
| Anti-Corruption Layer |
A set of adapters that isolate domain code from external libraries. Baander uses this for League OAuth2 Server — the domain only knows internal interfaces, not League's. |
| Bounded Context |
A distinct area of the codebase that models a specific business capability with its own domain language, rules, and data. Example: the Playlist context knows nothing about Transcoding. |
| Command |
A CQRS write operation — a DTO that carries input data to a handler. Commands are immutable (final readonly class). Example: CreatePlaylistCommand. |
| Domain Event |
A signal that something happened in the domain. Events are dispatched by handlers and listened to by other contexts. Example: TranscodeJobCompleted. |
| Domain Model |
A PHP class in Domain/Model/ that encapsulates business rules. Aggregate roots use a state object pattern; value objects are immutable with a public constructor. |
| Four-Layer Architecture |
Domain, Application, Infrastructure, Interface. Dependencies flow inward: Interface depends on Application, Application depends on Domain. Domain has no framework dependencies. |
| Port |
An interface in the Application layer that defines a capability (e.g., PlaylistPortInterface). Controllers inject ports; infrastructure implements them. This decouples the API layer from domain logic. |
| Repository Interface |
A contract in Domain/Repository/ for persisting and retrieving aggregates. The implementation lives in Infrastructure/Doctrine/Repository/. |
| State Object |
A mutable class ({Entity}State) that holds all fields of an aggregate root. It keeps the create() and reconstitute() constructors in sync and is used by the repository for persistence. |
| Value Object |
An immutable object identified by its value rather than an identity. Defined as final readonly class with a public constructor. Example: Uuid, PublicId, Email. |