nwidart/laravel-modules
Split large Laravel applications into self-contained, independently generated modules — each with its own routes, controllers, views, and migrations.
Repository Health
Technical Analysis
laravel-modules restructures how a Laravel application is organized by letting you break it into modules — self-contained mini-applications, each with their own controllers, models, views, routes, migrations, and service provider, generated via Artisan commands (module:make, module:make-controller, module:make-migration, and dozens more). It registers a ModulesServiceProvider that autoloads and boots every module, wires up module-scoped routing, and supports enabling/disabling individual modules at runtime through pluggable Activators. Because it changes the fundamental application structure (where code lives, how it’s discovered and bootstrapped) rather than being an imported utility, it functions as an architectural layer on top of Laravel rather than a standalone library — the successor to the unmaintained pingpong/modules package, now supported through Laravel 13.
What You Get
- A
module:makeArtisan command family that scaffolds new modules with controllers, models, migrations, views, seeders, requests, and more via dedicated generators ModulesServiceProvider/LaravelModulesServiceProviderthat auto-discovers, autoloads, and boots every module’s own service provider and routes- Module-scoped routing so each module defines its own
routes/web.php/api.phpwithout colliding with the main app’s route files - Pluggable
Activators(file-based or database-based) for enabling/disabling individual modules at runtime without removing their code - First-class support for both Laravel and Lumen applications, plus a
ModuleManifestcache for fast module discovery in production
Common Use Cases
- Breaking a large, monolithic Laravel codebase into feature-scoped modules that teams can own and develop independently
- Building a modular SaaS or CMS product where optional features (billing, reporting, integrations) ship as toggleable modules
- Sharing reusable modules across multiple Laravel projects by copying a self-contained module directory rather than extracting a full Composer package
- Enforcing architectural boundaries in domain-driven Laravel applications by giving each bounded context its own module
Under The Hood
Architecture - The package centers on Module.php and FileRepository.php, which discover module directories (each containing a module.json manifest, parsed by Json.php), and ModulesServiceProvider, which iterates discovered modules and registers each one’s own service provider, config, translations, views, and routes at boot time; ModuleManifest.php caches this discovery for production performance the same way Laravel caches its package manifest. Module scaffolding is handled by a Generators/ subsystem invoked from Commands/, and module enable/disable state is abstracted behind an Activators/ interface so it can be backed by a flat file or a database table. Tech Stack - PHP 8.3+, built against Laravel 13 (with historical support back to Laravel 5.4 tracked via version table in the README) and Lumen, depending on wikimedia/composer-merge-plugin to merge each module’s own composer.json autoload rules into the main application; dev tooling includes PHPUnit, Orchestra Testbench (for package-in-Laravel testing), PHPStan, and Laravel Pint. Code Quality - The project maintains an explicit Laravel-version compatibility matrix across 13 major releases, uses Testbench to run its test suite inside a real Laravel application context (closer to integration testing than pure unit tests), and enforces static analysis via PHPStan and style via Pint/php-cs-fixer; with 151 contributors and continuous releases through Laravel 13, it has weathered many major-version framework migrations. API Design - The command surface mirrors Laravel’s own make:* Artisan commands (module:make-controller, module:make-migration, etc.), so developers already fluent in Laravel conventions can pick it up with minimal new vocabulary; the tradeoff is an added layer of indirection — module-scoped autoloading, routing, and views require understanding the package’s manifest/discovery model on top of vanilla Laravel’s own conventions.
Used by 4 apps in this directory
Financial Freedom
Invoicing Finance
Own your financial data with a self-hosted, privacy-first budgeting app that replaces Mint and YNAB.
FreeScout
Customer Support
Run your own help desk and shared inbox — a fully self-hosted, open-source alternative to Zendesk and Help Scout with no per-agent fees.
Invoice Ninja
Invoicing Finance · Project Management
Self-hostable invoicing, time-tracking, and multi-gateway payment platform for freelancers and small businesses, with built-in e-invoicing compliance for EU and global standards.
solidtime
Productivity · Invoicing Finance
Modern open-source time tracker for freelancers and agencies with invoicing, multi-org support, and Toggl/Clockify migration built in.