Your Laravel app shipped clean four years ago. Today every feature touches three files that should be unrelated, the test suite takes nine minutes, and the upgrade from version 9 to 11 has sat as a stale draft pull request for two quarters. The framework didn't betray you. The team wrote a Laravel app - not an application that uses Laravel.
This book teaches you to write the second kind.
Decoupled PHP combines Hexagonal Architecture (Cockburn's ports and adapters) with Clean Architecture (Martin's four rings) in a single pragmatic synthesis built for PHP 8.3+. No Java-in-PHP translations. No religious arguments. Both architectures, both honest about what they do well, both applied to real Laravel 11 and Symfony 7 codebases.
Across 30 chapters and a complete, Dockerised reference application, you will:
Model a domain in pure PHP, with no framework imports and no Eloquent inheritance.Define ports in the language of the business, not the language of the database.Build the same use case behind three inbound adapters (HTTP, CLI, queue worker) and three outbound adapters (Doctrine, Guzzle, AMQP).Apply the dependency rule with Deptrac so the architecture is enforced by CI.Handle transactions, errors, domain events, observability, and authorization through ports.Migrate a legacy Laravel service and a legacy Symfony service to the same shape, in production, one endpoint at a time. No freeze week.Written for the mid-level to senior PHP engineer who has shipped a production service and watched it rot.