A Practical Guide to Laravel × DDD × Clean Architecture
About this guide
A 24-chapter guide for developers experienced with SPA development (Vue/React) to learn domain-driven design (DDD) and clean architecture with Laravel, step by step. Starting from the basics of Laravel, you build up strategic design (where to draw the lines), tactical design (how to build inside them), clean architecture implementation, operational quality, and a comprehensive hands-on practice in a continuous flow.
- Incremental: learn in the order Laravel basics → strategic design → tactical design → architecture implementation → operational techniques → comprehensive practice
- No Laravel experience needed: Chapter 2 covers the basics of Laravel API development before moving on to DDD
- A consistent example: follow how each concept lands in implementation using the order system of an e-commerce site
- Modern PHP assumed: targets PHP 8.2+ (readonly / enum / constructor promotion) and Laravel 11+
This guide is written against Laravel 11 and PHP 8.2. The current release is Laravel 13 (released in March 2026, requiring PHP 8.3 or later), and parts of the project layout have changed since, such as where service providers are registered. The design thinking behind DDD and clean architecture does not depend on the version, but check the official documentation for the latest Laravel-specific configuration and syntax. If you want to follow the basics of API development on Laravel 13, see the Laravel API development guide.
Structure of the guide
Learning path
The guide is organized into an introduction plus five parts, so you can learn step by step from the basics of Laravel to DDD in practice.
Introduction
| Chapter | What it covers |
|---|---|
| 01 Getting started | The aim of this guide and the architecture it assumes |
| 02 Basics of Laravel API development | Controller, FormRequest, Eloquent, DI |
Part 1: Strategic design
| Chapter | What it covers |
|---|---|
| 03 Why DDD | The limits of the Fat Controller / Fat Model |
| 04 An overview of DDD | The two layers: strategic and tactical design |
| 05 Strategic design | Subdomains, ubiquitous language, context maps |
| 06 EventStorming | A workshop for finding the model in the business |
Part 2: Tactical design
| Chapter | What it covers |
|---|---|
| 07 Basic concepts of DDD | Domain objects, aggregates, repositories |
| 08 Value objects | Immutable domain objects that encapsulate business rules |
| 09 Entities | Domain objects with an identifier and a lifecycle |
| 10 Aggregates | The consistency boundary and the aggregate root |
| 11 Domain services | Business logic that does not belong to an entity |
| 12 Domain events | Loosely coupling aggregates |
| 13 OOP and the tactical patterns | Which pattern each principle shows up in |
Part 3: Clean architecture and Laravel
| Chapter | What it covers |
|---|---|
| 14 A DDD architecture in Laravel | The 4-layer structure and dependency inversion |
| 15 Designing the use case layer | Command / Query separation and DTOs |
| 16 Designing the presentation layer | FormRequest, thin controllers, and API resources |
| 17 The repository pattern | The boundary between domain and persistence |
| 18 Domain model and table design | Mapping and indexes |
Part 4: Practical techniques
| Chapter | What it covers |
|---|---|
| 19 Transaction management | Where to place the consistency boundary |
| 20 Error handling | Mapping domain exceptions to HTTP statuses |
| 21 Testing strategy | The test pyramid and layered testing |
| 22 Authentication and authorization design | JWT and the division of responsibilities across layers |
Part 5: Comprehensive practice
| Chapter | What it covers |
|---|---|
| 25 In practice: implementing the order system | An example that cuts across all layers |
| 26 Conclusion and next steps | Introducing DDD incrementally |
Who this guide is for
- Frontend engineers with SPA development experience (Vue/React) who want to learn backend API development
- Developers without Laravel experience, as long as you know basic PHP syntax
- Anyone feeling the pain of "Fat Controller" and "Fat Model"
- Anyone unsure of where to put business logic
- Anyone who wants to write more maintainable code
Prerequisites
| Level | Knowledge |
|---|---|
| Required | Basic PHP syntax (classes, interfaces) |
| Required | Database basics (tables, relations) |
| Required | Basic API concepts (HTTP methods, JSON) |
| Recommended | Basic object-oriented concepts (encapsulation, inheritance, polymorphism) |
| Not required | Laravel experience (this guide covers it from the basics) |
Recommended ways to read
- Beginners: read top to bottom, running each chapter's code as you go
- Experienced with Laravel: skim Chapter 2 and start in earnest from Chapter 3, "Why DDD"
- Using it as a reference: open the relevant chapter directly from the chapter list above
Now, let's begin with Getting started.