image

Domain-Driven Design (DDD) vs. Standard MVC in Large Laravel Apps

18 Nov, 2026 Abdelrahman Etry

Laravel’s default app/Http/Controllers and app/Models directory structure is unmatched for shipping MVPs quickly. However, once a codebase crosses 80+ models, multiple business verticals, and several engineers committing daily, standard MVC begins to crack. Controllers bloat into 600-line procedural scripts, models become dumping grounds for unrelated business logic, and changing a billing rule accidentally breaks inventory dispatching.


Where Standard MVC Breaks Down

In classic MVC, code is organized by technical role (Controllers, Models, Services) rather than business capability. When you work on a single feature—such as "Checkout"—you have to jump across six top-level folders to trace the logic. Worse, models become tightly coupled: User ends up with 40 relationships spanning subscriptions, support tickets, fleet management, and notifications.


Pragmatic Modular DDD in Laravel

You don't need academic, textbook DDD with heavy XML mappings or detached ORMs to tame a large Laravel app. Instead, organize your src/Domains/ by bounded contexts (Billing, Inventory, Identity) while keeping Laravel's expressive Eloquent ergonomics intact:

PHP Sample Code:
// src/Domains/Billing/Actions/ProcessSubscriptionRenewalAction.php
final readonly class ProcessSubscriptionRenewalAction{
    public function __construct(
        private PaymentGatewayContract $gateway,
        private GenerateInvoiceAction $generateInvoice,
    ) {}

    public function execute(SubscriptionData $data): Invoice{
        $charge = $this->gateway->charge($data->customerId, $data->amountCents);

        return DB::transaction(fn () => $this->generateInvoice->execute($data, $charge));
    }
}


3 Rules for Pragmatic Laravel DDD

  1. Use Single-Purpose Actions: Move orchestration out of controllers and models into invokable or execute() Action classes named after business verbs.

  2. Communicate Across Domains via DTOs & Events: Never let the Inventory domain directly query Billing tables; dispatch domain events (OrderPaid) or pass immutable DTOs across domain boundaries.

  3. Keep Eloquent Pragmatic: Keep Eloquent models inside their owning domain (Domains/Billing/Models/Invoice.php) and extract complex query scopes into dedicated Query Builder classes.