Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Modular

Laravel Modular Laravel Package

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.

View on GitHub
Deep Wiki
Context7

A professional, framework-agnostic modular architecture for Laravel 11+. Features zero-config autoloading, 29+ Artisan command overrides, and seamless Vite integration.

Frequently asked questions about Laravel Modular
How do I install Laravel Modular in a Laravel 11 app?
Install it with composer require alizharb/laravel-modular, then run php artisan modular:install to publish config and scaffold the modules directory. The installer also wires up wikimedia/composer-merge-plugin so each module can carry its own composer.json. If you prefer a manual path, the docs cover adding the Modules\ PSR-4 mapping and updating vite.config.js to consume vite.modular.js. Expect roughly a day of work for a comfortable rollout, not a zero-touch install.
Which Laravel and PHP versions does Laravel Modular support?
Laravel Modular targets Laravel 11, 12 and 13 with a PHP 8.2+ floor. There is no Laravel 10 back-support, so older applications need to upgrade first. Because the package overrides 29+ native Artisan generators, major Laravel releases are the most likely breakage point and should be tested explicitly in CI.
How do the --module Artisan commands work?
Laravel Modular overrides more than 29 native Artisan commands so they accept a --module flag, for example php artisan make:model Post --module=Blog. Generated classes are placed in the module's own namespace, routes, migrations, config and stubs rather than in app/. This keeps the standard Laravel generator workflow intact while writing files into the right bounded context.
Why does Laravel Modular install composer-merge-plugin, and can I remove it?
The package uses wikimedia/composer-merge-plugin to achieve zero-config autoloading, merging each module's composer.json dependencies into the root autoloader. It is the biggest integration wrinkle, because the plugin must be allow-listed and behaves differently in CI. The recommended production posture is to run php artisan modular:sync to fold module dependencies into the root composer.json and then disable the merge plugin entirely.
How does dependency-aware module boot ordering work in Laravel Modular?
Modules declare dependencies on other modules, and a topological sort guarantees base modules boot before anything that depends on them. Diagnostics such as modular:check, modular:graph, modular:why and modular:doctor make the resolved graph visible when something looks wrong. Circular dependencies are still a runtime hazard if misconfigured, so keep the doctor check green in CI.
Is Laravel Modular fast enough for production?
Yes. Discovery results can be compiled with php artisan modular:cache, which brings module registration overhead close to zero on warm cache. Measure cold and warm cache timings in your own app during the spike phase, since boot cost scales with the number of modules and their providers. Add modular:cache to your deploy pipeline so cache warming is not a manual step.
Can I enable or disable modules at runtime?
Yes, module:enable and module:disable toggle modules, and modular:status and modular:debug show the current state. Be aware this is a compile-time architecture convention, not a plugin or marketplace loader, so activation interacts with discovery caching. Decide deliberately whether staging and production share a cache-busting step after any enable or disable.
Does Laravel Modular support Vite?
It ships a vite.modular.js entry that you include from your existing vite.config.js, so each module can own its assets and builds. The module_asset() helper resolves asset URLs from module paths, and the @moduleEnabled Blade directive lets you conditionally load them. Agree early with your frontend team on whether NPM workspaces per module are a supported workflow or out of scope.
Is Laravel Modular production ready and actively maintained?
The package has tests, PHPStan and a changelog, but it is maintained by a single author with a low install base and no stated stable major line. Treat it as a strategic dependency: pin versions, budget for a fork or self-maintained patch path, and confirm who owns fixes when a new Laravel release breaks generator overrides. The optional Livewire, Filament, Hooks and Themer packages each add their own maintenance delta, so do not bundle those into an initial rollout.
How does Laravel Modular compare to nwidart/laravel-modules, and can I migrate an existing app?
Laravel Modular differentiates itself with zero-config autoloading, strictly typed registries, topological boot ordering and production diagnostics rather than a plugin-style module loader. For migration, use a strangler pattern: extract one low-risk bounded context into modules/<Name> while keeping route, event and migration semantics intact, then run your full test suite. Start with a throwaway branch, exercise modular:doctor and a Vite build, and only then repeat per bounded context.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo