Glossary

Domain Events

A domain event is a fact that has occurred in the business domain: OrderPlaced, PaymentFailed, UserRegistered. Named in the past tense because it describes something that has already happened. A central concept in DDD and Event-Driven Architecture.

How it differs from a regular event

Technical event: ButtonClicked, FileUploaded. Domain event: InvoiceApproved, SubscriptionExpired — carries business meaning and is part of the ubiquitous language.

Why to use them

Example

class OrderPlaced {
  public function __construct(
    public readonly string $orderId,
    public readonly string $userId,
    public readonly Money  $total,
    public readonly \DateTimeImmutable $occurredAt,
  ) {}
}

// After successful persistence:
EventDispatcher::dispatch(new OrderPlaced($order->id, ...));