Menu

Untangling Dependency Cycles in a Modular Laravel Monolith
📰

Untangling Dependency Cycles in a Modular Laravel Monolith

DEV Community: laravel·Muhammad Ali Mughal·16 days ago
#n28XpIEj
#devtolaravel#devto#dev#modules#billing
Long article (1656 words) — no AI summary yet.
Reading 0:00
15s threshold

Once the strangler fig from Part 1 is working, the new Laravel app grows fast. Each migrated route brings a feature with it: dealers, orders, invoices, stock. Teams usually organise that into modules, something like app/Modules/Orders , app/Modules/Billing , app/Modules/Inventory . For a few months it feels clean. Then someone adds a call from Billing into Orders to check a status, someone else adds a call from Orders into Billing to fetch a price, and a year later every module imports every other one. You have rebuilt the legacy ball of mud, only with nicer folders.

I see this pattern often enough that I now add a dependency check before the second module exists. This post shows how to find cycles in an existing modular Laravel app, how to break them without a rewrite, and how to stop them from coming back.

I wrote this with help from AI tools and checked the commands against the deptrac and Laravel documentation.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.