Glossary

DTO (Data Transfer Object)

DTO (Data Transfer Object) is a simple, logic-free object designed solely to carry data between application layers or between services. Like a data structure: fields only, no behaviour.

Why it is needed

Example

class CreateUserDTO {
  public function __construct(
    public readonly string $name,
    public readonly string $email,
    public readonly string $password,
  ) {}
}

DTO vs Entity vs ViewModel