Clean Architecture in a Corporate Laravel Environment
Back
Advanced Plus

Clean Architecture in a Corporate Laravel Environment

This course continues the learning Laravel/Filament reference data system and moves it into Clean Architecture without religious overengineering. You will study why business rules should not live in a controller, Filament resource, Eloquent model, or console command, and you will learn how to design scenarios around actors: creating nomenclature through the admin panel, through API, and through document import. The main idea of the course is loose coupling from concrete implementations. Laravel, Filament, Eloquent, a queue, a database, and the import format are important, but they should remain external details. Inside there should be use cases, commands, queries, handlers, domain rules, contracts, and adapters. That is why the course separately covers CQRS, the Dependency Rule, actor-specific use cases, ports/adapters, mappers, transaction boundaries, layer testing, and deptrac/deptrac as an automatic architecture guard. The course uses a practical car body analogy: the front and rear parts of a car crumple on impact to protect the cabin and the people inside. In an application, Presentation and Infrastructure play a similar role: they absorb the impact of change so that Application and Domain remain stable. By the end of the course, you will have a clear Clean Architecture structure in src, several actor-specific nomenclature scenarios, command/query side separation, infrastructure adapters, presentation adapters for HTTP, Filament and Console, a Deptrac ruleset, and a final architecture defense of the solution.

Laravel DDD-lite Testing Make Architecture Guards Clean Architecture Corporate Laravel Filament Eloquent CQRS Ports and Adapters Deptrac Application Layer Domain Layer Infrastructure Layer Presentation Layer

Course outline

Published version: modules, lessons, and duration.

01

Working Baseline and Architecture Inventory

  1. 1 Project Root and Smoke Checks Before Architecture
    80 min
  2. 2 Current Laravel Architecture Map
    80 min
  3. 3 Why Folders Are Not Architecture
    80 min
02

Clean Architecture as Business-Process Protection

  1. 1 Framework as a Detail
    80 min
  2. 2 Dependency Rule in Human Language
    80 min
  3. 3 SRP, actor, and Three Nomenclature Creation Scenarios
    80 min
03

Moving the Structure into `src`

  1. 1 PSR-4 Namespace for src
    80 min
  2. 2 Four Layers in the Learning Project
    80 min
  3. 3 Laravel Bootstrap Stays Outside
    80 min
04

Domain Without Laravel

  1. 1 Domain Entity and Eloquent Model Are Different Things
    80 min
  2. 2 Nomenclature Invariants
    80 min
  3. 3 Domain Service Where the Object Is Too Tight
    80 min
05

Application and Use Cases

  1. 1 Use Case as an Actor-Specific Scenario
    80 min
  2. 2 Input DTO and Output Result
    80 min
  3. 3 Contracts and Ports
    80 min
  4. 4 Transaction Boundary
    80 min
06

CQRS Without Fanaticism

  1. 1 Command Changes State
    80 min
  2. 2 Query Reads State
    85 min
  3. 3 Why a Fat Service Breaks Support
    90 min
07

Infrastructure as a Layer of Replaceable Details

  1. 1 Eloquent Repository as an Adapter
    95 min
  2. 2 Bindings and Service Provider
    85 min
  3. 3 Files, Queue, Clock, and External API
    90 min
08

Presentation: HTTP, Console, and Filament

  1. 1 HTTP Controller as an Adapter
    90 min
  2. 2 Filament as a Presentation Adapter
    95 min
  3. 3 Console Command and Document Import
    95 min
  4. 4 Three Entry Points, Three Scenarios
    80 min
09

Deptrac and Architecture Checks

  1. 1 Installing Deptrac
    80 min
  2. 2 Rules for Four Layers
    80 min
  3. 3 Intentional Violation and Fix
    80 min
  4. 4 Architecture Check in the Make Workflow
    80 min
10

Testing Clean Architecture

  1. 1 Domain tests without the framework
    80 min
  2. 2 Application handler tests
    80 min
  3. 3 Adapter tests where Laravel is needed
    80 min
11

Final architecture flow assembly

  1. 1 Full nomenclature creation flow
    80 min
  2. 2 What happens if infrastructure is replaced
    80 min
  3. 3 Architecture defense of the solution
    80 min