Chapter 00 · Introduction · Preface

Preface

What this book is, who it is for, how it is structured, and how to read it depending on your role.

Author M. Katuščák
Reading time ≈ 14 min
Difficulty introductory
Published · Updated ·
In this chapter

This book grew out of a situation that keeps repeating itself. A developer opens Eric Evans's Domain-Driven Design: Tackling Complexity in the Heart of Software, reads 560 pages without a single line of PHP, and closes it with two questions. Where do I start? And how do I actually do this in Symfony? Between a text from 2003 and a PHP project in 2026 lies a layer of implementation detail that Evans could not cover. Vaughn Vernon worked through it in Implementing Domain-Driven Design (2013), with examples in Java.

PHP literature on DDD does exist, and this book does not replace it. Domain-Driven Design in PHP (Buenosvinos, Soronellas, Akbary) came out in 2017, and its second edition lives on at Leanpub. In Advanced Web Application Architecture (2020), Matthias Noback covers application architecture as a whole. Both titles aim elsewhere. The first goes deep on tactical patterns and hexagonal architecture, but gives strategic design little room and does not work with Symfony 8 in any consistent way. Noback is concerned with how to build an application, not with DDD.

That leaves a narrower gap: DDD from strategic decisions all the way down to code that runs on current Symfony. The book opens with the question of when DDD pays off at all. From there it moves through strategic and tactical design to concrete examples with Doctrine ORM 3, Symfony Messenger, and PHP 8.4. The examples are working code, not pseudocode.

P.01 Who this book is for#

The book assumes experience with PHP and Symfony, object-oriented programming, and the common design patterns. It does not assume any experience with DDD. If you know a Symfony controller, a Doctrine entity, and Dependency Injection, and you understand the difference between an interface and an abstract class, you have everything you need.

The book has five typical readers in mind:

  • A senior PHP developer whose project has hit the limits of a classic layered architecture. OrderService is 1,500 lines long, every new feature breaks something somewhere else, and onboarding a new colleague takes months.
  • A junior or mid-level Symfony developer who has noticed that larger projects “grow” differently from small ones and is looking for more structure than Controller-Service-Repository alone.
  • An architect choosing how to model domain logic: DDD, classic CRUD, a modular monolith, or microservices.
  • A tech lead who has to explain to the team why and how to adopt DDD, and needs arguments for management grounded in DORA metrics and business value.
  • Finally, a developer migrating a CRUD application to DDD. There is spaghetti code in production, and the way out has to come in small steps.

Each role has its own recommended reading path, described in P.03 How to read this book.

What this book is not

  • Not an introduction to PHP or Symfony. If Symfony is new to you, start with the official Symfony documentation.
  • Not a copy-and-paste cookbook. The code illustrates patterns in context; it is not a ready-made solution for your project. DDD requires judgment about the domain, not mechanical template filling.
  • Not a complete DDD reference. For a deeper theoretical foundation, read Evans (2003), Vernon (2013), and Khononov (2021). References to specific passages appear directly in the chapter text and in the list of resources.
  • Not a guarantee that you will sell DDD to leadership. The book provides measurable arguments and devotes a separate section to DORA metrics and communicating with management. How the conversation ends, though, depends more on the organization than on the quality of the argument.
  • Not a reference manual for Doctrine or Messenger. The text uses both components only to the extent DDD needs them. For mapping details, DQL, or transports, see the libraries' own documentation.

Prerequisites

Starting knowledge:

  • PHP 8.4+: attributes (#[Attribute]), enums, readonly properties, named arguments, match, and asymmetric visibility (public private(set)). The code runs unchanged on newer PHP versions.
  • Symfony 8+: the Service Container, Dependency Injection, Doctrine ORM 3, Symfony Messenger, and the #[Route] and #[AsMessageHandler] attributes.
  • Object-oriented programming: inheritance vs. composition, polymorphism, encapsulation, the SOLID principles.
  • Design patterns: Repository, Factory, Strategy, Observer. Formal knowledge is not required; recognizing them in code is enough.
  • Relational databases: ACID, transactions, indexes, JOINs, optimistic and pessimistic locking.

One more note on the stack, for anyone starting a new project. Symfony ships a minor version every six months and supports each one for a short time; long-term support always goes to the last minor of a major line. As of September 2026, the current LTS is Symfony 7.4. It needs only PHP 8.2 and works with Doctrine ORM 2 as well, but some of the examples will not run on that stack: asymmetric visibility public private(set) requires PHP 8.4, and ORM 3 behaves differently from version 2 in a number of places.

The book therefore targets Symfony 8, whose first LTS is not expected until late 2027. Until then, you get the most out of the book if you stay on the current stable release and plan to upgrade roughly every six months. The patterns themselves do not change between minor versions; the APIs around them do.

If you lack some of this background, you can still read the book; a few chapters will only take more concentration. Each chapter header states its difficulty. Eight chapters carry the highest rating, among them Aggregate Design, Event Sourcing, Sagas, DDD and Microservices, and the closing case study.

P.02 What the book covers#

The book is divided into eight thematic parts, and each chapter builds on the ones before it. The website's hub pages group the same chapters more coarsely: Foundations (ch. 1–5), Tactics (6–8), Architecture (9–11), Patterns (12–16), Practice (17–22), and Synthesis (23–24). The part boundaries line up with them, except that Practice spans parts 5 through 7.

Strategy comes before tactics on purpose. At QCon London 2009, Evans summarized what he would do differently in his book: he had overemphasized the building blocks, while context boundaries and the Core Domain should have come much earlier. The structure of this book follows from that reassessment.

Part 1 – Strategic design (ch. 1–5)

Strategic design decides where to apply DDD in the first place. It covers the philosophy of DDD, Ubiquitous Language, identifying subdomains (Core, Supporting, Generic), and Bounded Context and Context Mapping. It is rounded out by two practical techniques without which strategic design does not work in a real organization: Alberto Brandolini's Event Storming and Team Topologies (Skelton & Pais, 2019).

This is where you decide whether to continue. Chapters 1 and 2 give the first signal: whether your project has a complex enough domain, and where its Core lies. The full framework, with a decision tree, is in the chapter When Not to Use DDD. Before a “no” signal makes you set the rest of the book aside, check it there.

Part 2 – Tactical design (ch. 6–8)

Tactical design covers the concrete building blocks of a domain model: entities, value objects, aggregates, repositories, domain services, and domain events. DDD Building Blocks introduces the vocabulary for them. The center of gravity of the tactical part is chapter 7 on Aggregate Design. The aggregate boundary is the hardest decision in tactical DDD, and getting it wrong costs many times more than a mistake in a single class.

The tactical part closes with supporting tactical patterns (Specification Pattern, Factory, Module).

Part 3 – Architecture and implementation in Symfony (ch. 9–11)

A comparison of architectural styles (Layered, Hexagonal, Onion, Clean Architecture, Vertical Slice) determines where the modeled code goes. Next comes a concrete mapping of DDD onto Symfony 8: a directory structure organized by Bounded Contexts, custom Doctrine types for Value Objects, Symfony Messenger as the Command/Query Bus, Dependency Injection, and autowiring.

Chapter 11 handles authorization in four layers: Edge (firewall), Use Case (Voter), Aggregate (domain invariant), and Field (read model filtering).

Part 4 – Advanced patterns and performance (ch. 12–16)

CQRS (separating reads from writes), Event Sourcing (state as a sequence of events), Sagas and Process Managers (long-running processes with compensation), and the Outbox Pattern (reliable delivery of events outside the context). The part closes with the chapter Read Models, Projections, and Performance (the N+1 problem, lazy loading, read models, snapshots, hot aggregates).

These patterns do not fit every project, so the chapters also examine when they are not worth it.

Part 5 – Testing (ch. 17)

Testing strategy: unit tests for the domain layer, integration tests with Doctrine, and architecture tests with Deptrac.

Part 6 – Migration and microservices (ch. 18–19)

A gradual transition from a CRUD architecture to DDD using the Strangler Fig Pattern. The relationship between Bounded Context and microservice: when the 1:1 mapping holds, when a modular monolith works out better than distributed services, and how to spot a distributed monolith early.

Part 7 – Operational problems and anti-patterns (ch. 20–22)

Three chapters look from different angles at what goes wrong with DDD. Chapter 20 covers specific operational friction with Doctrine, Messenger, and Symfony Forms. Chapter 21 is a catalog of code-level anti-patterns (the anemic model, Primitive Obsession, the God Aggregate, the shared database). Chapter 22 answers the question of when not to use DDD at all.

Part 8 – Practical examples (ch. 23–24)

Three short examples (an e-shop, a blog, user management) serve as a cross-section that ties things together. The closing case study walks through building a project management system step by step, from domain analysis through architecture, aggregates, and CQRS to read models with reconciliation.

Note: Outside the main sequence of chapters, the website also has DDD and Artificial Intelligence. That chapter summarizes what Eric Evans, Martin Fowler, Kent Beck, and others say about the relationship between DDD and AI. It is missing from the print and EPUB editions because the topic moves fast and the website can be updated more readily.

P.03 How to read this book#

Reading from the first chapter to the last works, but few people need to. Most readers open the book because of a specific pain point. Here are five recommended paths by role:

For a junior or mid-level Symfony developer

Goal: understand what DDD is and learn to recognize it in someone else's code. Your own implementation will come with your second or third project. Recommended order:

Optionally, after a month of practice: CQRS and Anti-Patterns and Common Mistakes.

For a senior PHP developer

Instead of reading from chapter one, it pays to enter the book at the problem that brought you here.

Reading straight through from chapter 1 to 24 pays off if you are introducing DDD for the first time on a greenfield project. For a cross-section of the whole book in a single example, see the Case Study.

For an architect

This path runs through strategy and the big picture: less code, more decisions.

For a tech lead

The organizational view and the practical problems. The path starts with the chapter Conway's Law and Team Topologies, that is, with the question of how team structure shapes architecture. It continues with Event Storming and Domain Storytelling, which includes a workshop you can run with your team, and Migrating from CRUD to DDD, which describes a gradual transition without halting development. DDD in Practice – Where It Hurts sets realistic expectations. Two chapters remain: Anti-Patterns and Common Mistakes, an overview of the code signals to look for in code review, and When Not to Use DDD, for the moments when saying no is the right call.

For a developer migrating from CRUD

A concrete path for transforming an existing project step by step.

After that, pick further chapters based on where your application hurts.

P.04 Conventions in this book#

The following conventions apply throughout all chapters.

Voice and tone

The book addresses you directly. Sentences are short to medium in length, and each one says one thing. Instead of calling something “a powerful framework,” the text states specifically what Symfony Messenger can and cannot do. There are no personal asides from the author and no hype. The text is written in American English, keeps strategic DDD terms in their established form (Bounded Context, Ubiquitous Language, Context Map), and uses imperatives only where it walks you through a step you are meant to take.

Code style

The code targets PHP 8.4 and Symfony 8 with Doctrine ORM 3. The Prerequisites section summarizes which language features the examples assume. On an older version the principle still holds; only the syntax differs.

Doctrine attributes (#[ORM\Entity]) sit directly on the domain classes as a pragmatic default. Strict separation of the domain layer from the ORM is available through the Persisted Object Pattern, meaning a separate persistence class plus a mapper. Most examples use the first option because it is more common in Symfony projects.

The examples also share a single vocabulary, which you first encounter in DDD Building Blocks:

  • Aggregates extend an AggregateRoot base class with record() and releaseEvents() methods.
  • Domain events are named in the past tense without an Event suffix: OrderPlaced, not OrderPlacedEvent.
  • Value objects expose public readonly properties, read as $email->value.
  • Identifiers are created with symfony/uid and Uuid::v7().
  • Aggregates reference one another by ID only. A whole instance of one aggregate is never passed into a method of another.
  • Command-bus commands are named with a verb phrase and no suffix (PlaceOrder, RegisterUser); their handlers carry the Handler suffix (PlaceOrderHandler).
  • Money and other shared value objects live in App\SharedKernel\Domain, as does AggregateRoot.

The running example is an order. It is created via Order::place(), accepts line items through the addItem() method, and holds amounts in a Money value object. The trio of Order, Money, and Email returns chapter after chapter, so you do not have to learn a new domain for every pattern.

Every PHP block in the book passes a php -l check in CI. The examples are therefore syntactically valid, but they remain illustrations of a pattern. Before you deploy them, they need to be adapted to your own domain.

Page elements

Each chapter header shows the estimated reading time and a difficulty rating on a scale of 1 to 4. The text ends with a block of frequently asked questions, and some chapters follow it with a section of sources and further reading. Two navigation pages accompany the entire book: the Cheat Sheet and the Glossary.

Callouts

The book uses four types of callout boxes. A blue note adds context or points to a deeper source. A green pattern recommends a pattern with concrete code, and an orange warn flags a risk or a common mistake. A red anti marks an anti-pattern.

Diagrams

Diagrams are generated from PlantUML sources and embedded in the text as SVG. The .puml sources are in the book's repository.

Internal links

Internal links between chapters use paths (such as /en/what-is-ddd or /en/basic-concepts), not chapter numbers, so renumbering does not break them. The video course is in Czech; links to it are marked “CZ.” External links to books and articles use the full URL.

Citations

The text cites books and reference articles right where they are used (for example, “Vernon, Implementing DDD, ch. 8”), and many chapters also collect them in a closing further-reading section. The main sources the book builds on:

  • Eric Evans, Domain-Driven Design: Tackling Complexity in the Heart of Software (Addison-Wesley, 2003).
  • Vaughn Vernon, Implementing Domain-Driven Design (Addison-Wesley, 2013) and Domain-Driven Design Distilled (2016).
  • Vlad Khononov, Learning Domain-Driven Design (O'Reilly, 2021).
  • Sam Newman, Building Microservices, 2nd ed. (O'Reilly, 2021).
  • Chris Richardson, Microservices Patterns (Manning, 2018).
  • Matthew Skelton & Manuel Pais, Team Topologies (IT Revolution, 2019; second edition 2025).
  • Martin Fowler, Patterns of Enterprise Application Architecture (Addison-Wesley, 2002).

P.05 What's next#

If this is your first visit, open the chapter What Is Domain-Driven Design. By the end of it, you should know whether to continue. For the opposite conclusion, the chapter When Not to Use DDD offers a decision framework.

If you already know DDD and are looking for a specific topic, go through the Cheat Sheet, a one-page overview of the patterns with links to the relevant chapters. For definitions of terms, see the Glossary.

The book is a living document. The current version of the text is always available at ddd-v-symfony.katuscak.cz, and contact details for corrections and feedback are on the About the author page.

Frequently asked questions

Do I have to read the book linearly, starting with the first chapter?

No. The chapters are ordered so that each builds on the one before it, but most readers arrive with a specific problem. The section How to read this book offers five paths by role: junior or mid-level Symfony developer, senior PHP developer, architect, tech lead, and developer migrating from CRUD. Reading straight through from chapter 1 to 24 pays off mainly when you are introducing DDD for the first time on a new project.

Do I need to read Evans or Vernon before this book?

No. The book assumes no prior knowledge of DDD, only experience with PHP, Symfony, and object-oriented programming. Evans (2003), Vernon (2013), and Khononov (2021) remain the source of a deeper theoretical foundation, and references to specific passages appear directly in the chapter text. The Citations section and the Resources page list the titles.

Will the examples run on Symfony 6 or 7?

The examples target PHP 8.4, Symfony 8, and Doctrine ORM 3, as described in the Prerequisites section. On an older stack, some of the syntax does not work; asymmetric visibility public private(set), for example, requires PHP 8.4. The patterns themselves do not depend on the framework version, so the principle stays valid and only the notation changes.

Can I use the code from the book in my own project?

The examples are written so that you can adopt them, and every PHP block passes a php -l check in CI. They remain illustrations of a pattern, though, not finished solutions. Aggregate boundaries, event names, and the structure of contexts all derive from a specific domain, so copying them unchanged usually carries someone else's model into your project.