Beyond the Service Layer: How the ADR Pattern Finally Solves the Fat Controller Problem
Why traditional MVC is an awkward fit for modern web APIs. Shifting from monolithic multi-action controllers to the clean Action-Domain-Responder (ADR) pattern.
Engineering context & problem
Controllers in HTTP APIs routinely bloat with validation, DTO mapping, status code logic, and cross-cutting concerns. Service layers frequently degenerate into generic procedural god-classes.
Architectural approach & solution
Replace monolithic controller classes with a clean Single-Action Invokable class that orchestrates pure Domain services and a dedicated Responder:
Core code snippet & configuration
<?php
declare(strict_types=1);
namespace App\UI\Http\Action;
use App\Domain\Invoice\CreateInvoicePayload;
use App\Domain\Invoice\InvoiceService;
use App\UI\Http\Responder\InvoiceResponder;
use Symfony\Component\HttpFoundation\Response;
final readonly class CreateInvoiceAction
{
public function __construct(
private InvoiceService $domain,
private InvoiceResponder $responder
) {}
public function __invoke(CreateInvoicePayload $payload): Response
{
$result = $this->domain->create($payload);
return $this->responder->created($result);
}
}Key takeaways & engineering rules
ADR cleanly separates responsibilities: Action (HTTP input handling), Domain (pure business rules), and Responder (HTTP response formatting).
Single-Action Controllers (utilizing PHP’s __invoke) eliminate multi-thousand line controller files and drastically simplify testing.
The Responder cleanly isolates presentation schemas and status codes from internal domain models.
Trade-offs & when NOT to use
Creates more granular class files in your filesystem. Demands disciplined directory layout by feature slice.
Summary
A complete architectural walkthrough of implementing ADR in PHP with before-and-after refactoring examples in Symfony and Laravel.
Full article with source code
Want to read the full article with deep implementation details?
Click below to access the complete story on Medium with zero paywalls (free access enabled via author friend link).
Looking for backend architecture guidance?
I help teams modernize legacy monoliths, containerize workloads, and build pragmatic AI tooling.