2025-09-18 · 8 min read
SOLID service layers that survive real Laravel apps
LaravelSOLIDClean Code
Laravel makes it easy to dump everything into controllers. That works until payment, inventory, and CRM rules collide in one action method.
I keep controllers as HTTP adapters, Form Requests for validation, repositories for persistence queries, and application services for orchestration. Domain policies decide who can do what.
Avoid inventing a new abstraction for every class. Extract only when a use-case has multiple entry points (HTTP, job, artisan) or when tests get painful.
Pest/PHPUnit around services beats UI-only confidence. Cover the money paths first: capture, refund, stock decrement, and webhook replay.