alizharb/laravel-modular
Laravel Modular is a strictly typed modular system for Laravel 11/12/13 with zero config. Over 29 native Artisan commands support --module, plus dependency-aware boot ordering, caching, auto-discovery, and production diagnostics.
Architecture fit
The package implements a modular monolith — bounded contexts as first-class directories under modules/ with their own providers, routes, migrations, configs, stubs, and even composer.json/package.json. For a TPM, this is the sweet spot between a single Laravel app and premature microservices: it gives namespace isolation and enforced dependency ordering (topological boot) without distributed-system overhead. It fits teams that want DDD-lite decomposition, team-per-module ownership, or reusable domain packages. It is not a plugin/marketplace system (despite dynamic enable/disable); it's a compile-time architecture convention.
Integration feasibility
Low-friction at the surface: composer require + php artisan modular:install, plus a documented manual path (PSR-4 Modules\ mapping and Vite config). The modular:install step auto-installs and configures wikimedia/composer-merge-plugin — that dependency is the single biggest integration wrinkle (plugin allow-listing, CI behavior, and the project's own recommendation to run modular:sync and then disable the merge-plugin for production). Vite integration requires editing vite.config.js to consume vite.modular.js. Feasible in a day for a competent Laravel dev; not zero-touch.
Technical risk
modular:check helps, but circulars still surface at runtime if misconfigured).Key questions
modular:sync viable as the permanent production posture, eliminating the merge-plugin entirely?modular:cache) interact with module:enable/disable in staging vs. production?vite.modular.js + NPM workspaces as a supported workflow?Stack fit
PHP 8.2+ / Laravel 11–12, Composer, Vite, Pest — all table-stakes for a modern Laravel shop. The modular config('Blog::settings.key') case-insensitive convention and module(), module_path(), module_asset(), @moduleEnabled Blade directives slot cleanly into existing patterns. Filament/Livewire integration is optional and additive; don't bundle that decision into the initial rollout.
Migration path (strangler-style)
make:module Blog, exercise modular:list --tree, modular:doctor, modular:check, a generate-model-with-migration flow, and a Vite build. Measure modular:cache cold/warm.modules/<X>, keeping route/event/migration semantics intact. Validate against a full test suite.modular:sync to fold module dependencies into the root composer.json and disable the merge-plugin; add modular:cache to the deploy pipeline.modular:doctor staying green.Compatibility
App\... or expect app/ layout; Modules\ PSR-4 must not collide.modular:test and existing Pest suites both run in CI.vite.modular.js coexists with whatever Vite config the team already has (input/refresh arrays).Sequencing
Spike → domain extraction → CI hardening (doctor, check, cache) → deploy-pipeline changes (modular:migrate, asset link) → optional ecosystem add-ons (Livewire, Filament, Hooks) only after core is stable. Keep the merge-plugin disabled in production before go-live.
Maintenance
Changelog and tagged releases exist (last release 2026-07-08), README and docs/ are credible, MIT license is clean. But: single maintainer, 23 stars, no downstreams. Plan for a fork + internal patch lane on the generator overrides, and pin the version. Track Laravel's make:* changes each minor as the trigger for a regression run.
Support Community/GitHub issues only — no commercial SLA. Sponsor link exists but is not a support contract. This is acceptable for an internal framework convention, not for compliance-locked deliverables. Escalation must be internal.
Scaling
Two axes matter. (a) Module count: discovery caching (modular:cache) is designed for this and is the key production lever; watch cold-boot time as modules grow and modular:list --tree to spot dependency depth. (b) Frontend: NPM workspaces via modular:npm scale, but asset link/publish (modular:link) must be part of every deploy or images/CSS 404.
Failure modes to design for
modular:check in CI).modular:cache after module:enable/disable → 404s or missing routes.Ramp-up
For devs fluent in Laravel's make:* and artisan migrate, --module= is a near-native leap: roughly 1–3 days to productive, plus concepts for module.json, the ModuleRegistry, topological boot order, and module-scoped config. Frontend devs need half a day on vite.modular.js and workspaces. The TPM artifact that pays for itself: a short internal "modular conventions" doc covering dependency rules, generator usage, deploy checklist (doctor → check → cache → migrate → link), and the fork/patch policy. Do that before scaling beyond two modules.
How can I help you explore Laravel packages today?