internachi/modular
A lightweight module system for Laravel apps using Composer path repositories and Laravel package discovery. Create self-contained modules in an app-modules/ directory, following standard Laravel package conventions with minimal extra tooling.
Full Changelog: https://github.com/InterNACHI/modular/compare/3.0.1...3.0.2
Full Changelog: https://github.com/InterNACHI/modular/compare/3.0.0...3.0.1
Modular 3.0 is a mostly backwards-compatible rewrite of much of the modular core.
Modular 3.0 introduces a plugin-based architecture that replaces the monolithic service provider with focused, composable plugin classes. This architectural refactoring improves extensibility, testability, and separation of concerns.
Each aspect of module auto-discovery is now handled by a dedicated plugin:
| Plugin | Responsibility |
|---|---|
ModulesPlugin |
Discovers composer.json files and creates ModuleConfig instances |
RoutesPlugin |
Loads route files from modules |
ViewPlugin |
Registers view namespaces |
BladePlugin |
Registers Blade components with module namespaces |
TranslatorPlugin |
Registers translation namespaces and JSON paths |
EventsPlugin |
Discovers and registers event listeners |
MigratorPlugin |
Registers migration paths |
GatePlugin |
Auto-registers model policies |
ArtisanPlugin |
Registers console commands |
Third-party packages or application code can register custom plugins:
use InterNACHI\Modular\PluginRegistry;
PluginRegistry::register(MyCustomPlugin::class);
Custom plugins will be automatically integrated into the caching system and can use the attribute-based lifecycle controls.
Each plugin implements a two-phase lifecycle:
discover() - Scans the filesystem and returns serializable discovery datahandle() - Processes the discovered data (registers with Laravel services)PHP 8 attributes control when plugins execute:
use InterNACHI\Modular\Plugins\Attributes\AfterResolving;
#[AfterResolving(BladeCompiler::class)]
class BladePlugin extends Plugin
{
// Only runs when BladeCompiler is resolved
}
The modules:cache command now caches all plugin discovery data in a single file (bootstrap/cache/app-modules.php). This simplifies cache invalidation and reduces filesystem operations during bootstrapping.
Modular 3.0 requires Laravel 11 or later and PHP 8.3 or later. This allows us to leverage modern PHP features like attributes and constructor property promotion throughout the codebase.
The Livewire integration has been moved to a separate package to keep the core package focused and reduce dependencies.
Please see the Upgrade Guide for a complete list of breaking changes and migration instructions.
Full Changelog: https://github.com/InterNACHI/modular/compare/2.3.0...3.0.0
Modular 3.0 is a mostly backwards-compatible rewrite of much of the modular core.
Modular 3.0 introduces a plugin-based architecture that replaces the monolithic service provider with focused, composable plugin classes. This architectural refactoring improves extensibility, testability, and separation of concerns.
Each aspect of module auto-discovery is now handled by a dedicated plugin:
| Plugin | Responsibility |
|---|---|
ModulesPlugin |
Discovers composer.json files and creates ModuleConfig instances |
RoutesPlugin |
Loads route files from modules |
ViewPlugin |
Registers view namespaces |
BladePlugin |
Registers Blade components with module namespaces |
TranslatorPlugin |
Registers translation namespaces and JSON paths |
EventsPlugin |
Discovers and registers event listeners |
MigratorPlugin |
Registers migration paths |
GatePlugin |
Auto-registers model policies |
ArtisanPlugin |
Registers console commands |
Third-party packages or application code can register custom plugins:
use InterNACHI\Modular\PluginRegistry;
PluginRegistry::register(MyCustomPlugin::class);
Custom plugins will be automatically integrated into the caching system and can use the attribute-based lifecycle controls.
Each plugin implements a two-phase lifecycle:
discover() - Scans the filesystem and returns serializable discovery datahandle() - Processes the discovered data (registers with Laravel services)PHP 8 attributes control when plugins execute:
use InterNACHI\Modular\Plugins\Attributes\AfterResolving;
#[AfterResolving(BladeCompiler::class)]
class BladePlugin extends Plugin
{
// Only runs when BladeCompiler is resolved
}
The modules:cache command now caches all plugin discovery data in a single file (bootstrap/cache/app-modules.php). This simplifies cache invalidation and reduces filesystem operations during bootstrapping.
Modular 3.0 requires Laravel 11 or later and PHP 8.3 or later. This allows us to leverage modern PHP features like attributes and constructor property promotion throughout the codebase.
The Livewire integration has been moved to a separate package to keep the core package focused and reduce dependencies.
Please see the Upgrade Guide for a complete list of breaking changes and migration instructions.
Full Changelog: https://github.com/InterNACHI/modular/compare/2.2.1...3.0.0-beta.1
Moved Modularize helper trait to separate package.
Full Changelog: https://github.com/InterNACHI/modular/compare/3.0.0-alpha.1...3.0.0-alpha.2
Modular 3.0 is a mostly backwards-compatible rewrite of much of the modular core.
Modular 3.0 introduces a plugin-based architecture that replaces the monolithic service provider with focused, composable plugin classes. This architectural refactoring improves extensibility, testability, and separation of concerns.
Each aspect of module auto-discovery is now handled by a dedicated plugin:
| Plugin | Responsibility |
|---|---|
ModulesPlugin |
Discovers composer.json files and creates ModuleConfig instances |
RoutesPlugin |
Loads route files from modules |
ViewPlugin |
Registers view namespaces |
BladePlugin |
Registers Blade components with module namespaces |
TranslatorPlugin |
Registers translation namespaces and JSON paths |
EventsPlugin |
Discovers and registers event listeners |
MigratorPlugin |
Registers migration paths |
GatePlugin |
Auto-registers model policies |
ArtisanPlugin |
Registers console commands |
Third-party packages or application code can register custom plugins:
use InterNACHI\Modular\PluginRegistry;
PluginRegistry::register(MyCustomPlugin::class);
Custom plugins will be automatically integrated into the caching system and can use the attribute-based lifecycle controls.
Each plugin implements a two-phase lifecycle:
discover() - Scans the filesystem and returns serializable discovery datahandle() - Processes the discovered data (registers with Laravel services)PHP 8 attributes control when plugins execute:
use InterNACHI\Modular\Plugins\Attributes\AfterResolving;
#[AfterResolving(BladeCompiler::class)]
class BladePlugin extends Plugin
{
// Only runs when BladeCompiler is resolved
}
The modules:cache command now caches all plugin discovery data in a single file (bootstrap/cache/app-modules.php). This simplifies cache invalidation and reduces filesystem operations during bootstrapping.
Modular 3.0 requires Laravel 11 or later and PHP 8.3 or later. This allows us to leverage modern PHP features like attributes and constructor property promotion throughout the codebase.
The Livewire integration has been moved to a separate package to keep the core package focused and reduce dependencies.
Please see the Upgrade Guide for a complete list of breaking changes and migration instructions.
Full Changelog: https://github.com/InterNACHI/modular/compare/2.3.0...3.0.0-alpha.1
getApplicationBasePath naming in testbench by @inxilpro in https://github.com/InterNACHI/modular/pull/111Factory by @samlev in https://github.com/InterNACHI/modular/pull/110Full Changelog: https://github.com/InterNACHI/modular/compare/2.2.1...2.3.0
Full Changelog: https://github.com/InterNACHI/modular/compare/2.2.0...2.3.0
Full Changelog: https://github.com/InterNACHI/modular/compare/2.1.0...2.2.0
[!note] This will be the last version to support Laravel 9 and PHP 8.0.
Full Changelog: https://github.com/InterNACHI/modular/compare/2.0.0...2.1.0
Note The
2.0.0and1.12.0releases are functionally the same. The only changes are in composer version constraints, removing code that was specific to Laravel 7, and a handful of refactors to PHP 8 language features.
make:command changes in Laravel 10Full Changelog: https://github.com/InterNACHI/modular/compare/1.10.0...1.11.0
make:migration and make:livewire were not loading the custom --module optionmake: commands to catch necessary changes quicker in the future--module flag for an unknown module now triggers a console error<x-module::component.name />)make:seeder command introduced in Laravel 9.6.0make:livewire integration if Livewire is installedAdded support for PhpStorm's workspace.xml to the sync command and updated a test to match recent Laravel 8.0 changes.
make:castmake:livewire command--module in php artisan db:seed--module flag is used in Laravel 8+--module flag is used in Laravel 8+diglactic/laravel-breadcrumbs for breadcrumbs checkSort routes by name by default.
AutoDiscoveryHelperAdds a fix for Windows directory separators.
How can I help you explore Laravel packages today?