Skip to main content

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.

What makes this guide different
  • 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+
About the versions used here

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​

ChapterWhat it covers
01 Getting startedThe aim of this guide and the architecture it assumes
02 Basics of Laravel API developmentController, FormRequest, Eloquent, DI

Part 1: Strategic design​

ChapterWhat it covers
03 Why DDDThe limits of the Fat Controller / Fat Model
04 An overview of DDDThe two layers: strategic and tactical design
05 Strategic designSubdomains, ubiquitous language, context maps
06 EventStormingA workshop for finding the model in the business

Part 2: Tactical design​

ChapterWhat it covers
07 Basic concepts of DDDDomain objects, aggregates, repositories
08 Value objectsImmutable domain objects that encapsulate business rules
09 EntitiesDomain objects with an identifier and a lifecycle
10 AggregatesThe consistency boundary and the aggregate root
11 Domain servicesBusiness logic that does not belong to an entity
12 Domain eventsLoosely coupling aggregates
13 OOP and the tactical patternsWhich pattern each principle shows up in

Part 3: Clean architecture and Laravel​

ChapterWhat it covers
14 A DDD architecture in LaravelThe 4-layer structure and dependency inversion
15 Designing the use case layerCommand / Query separation and DTOs
16 Designing the presentation layerFormRequest, thin controllers, and API resources
17 The repository patternThe boundary between domain and persistence
18 Domain model and table designMapping and indexes

Part 4: Practical techniques​

ChapterWhat it covers
19 Transaction managementWhere to place the consistency boundary
20 Error handlingMapping domain exceptions to HTTP statuses
21 Testing strategyThe test pyramid and layered testing
22 Authentication and authorization designJWT and the division of responsibilities across layers

Part 5: Comprehensive practice​

ChapterWhat it covers
25 In practice: implementing the order systemAn example that cuts across all layers
26 Conclusion and next stepsIntroducing 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​

LevelKnowledge
RequiredBasic PHP syntax (classes, interfaces)
RequiredDatabase basics (tables, relations)
RequiredBasic API concepts (HTTP methods, JSON)
RecommendedBasic object-oriented concepts (encapsulation, inheritance, polymorphism)
Not requiredLaravel experience (this guide covers it from the basics)
  • 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.