Download the PHP package mehediishere/laravel-modular without Composer
On this page you can find all versions of the php package mehediishere/laravel-modular. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mehediishere/laravel-modular
More information about mehediishere/laravel-modular
Files in mehediishere/laravel-modular
Package laravel-modular
Short Description Native zero-dependency modular architecture for Laravel ERP systems. Provides module discovery, sidebar management, and artisan scaffolding.
License MIT
Homepage https://github.com/mehediishere/laravel-modular
Informations about the package laravel-modular
mehediishere/laravel-modular
A native, zero-dependency modular architecture package for Laravel Modular systems.
No magic traits. No JSON state files. Just pure Laravel.
Features
- Module discovery — enable/disable modules from a single config file
- Zero dependencies — built entirely on Laravel's own service container, routing, and filesystem
- Sidebar management with group merging — modules declare a
group_id; any modules sharing the samegroup_idare automatically merged into one dropdown in the admin panel - Permission-filtered sidebar — items invisible to the current user are stripped before rendering
- Artisan scaffolding —
php artisan module:make POSgenerates the full folder structure with stubs - Publishable stubs — customise the scaffolding output to match your team's conventions
- Per-module config, migrations, views, routes, translations, and commands — all self-registering
- Sidebar caching — per-user cache with configurable TTL
- Laravel auto-discovery — no manual provider registration needed
Requirements
| Dependency | Version | ||
|---|---|---|---|
| PHP | ^8.2 | ||
| Laravel | ^11.0 | ^12.0 | ^13.0 |
Installation
Laravel's package auto-discovery registers the service provider automatically.
Publish the config files:
This creates two files in your project:
config/modular.php— package settings (sidebar cache, TTL)config/modules.php— your enabled modules list and base path
Add the Modules namespace to your project's composer.json:
Then run composer dump-autoload.
Quick start
1. Scaffold a module
Each command creates a full module folder at Modules/{Name}/:
2. Enable the module
Open config/modules.php and add your module:
3. Autoload and migrate
Sidebar management
The group_id concept
The sidebar is built from each module's config/sidebar.php. The key field is group_id — a short snake_case string that identifies which dropdown group this module's items belong to.
Modules with the same group_id are merged into one dropdown.
This means you can have Account and Payroll as separate modules but group them both under a single "Finance" dropdown in the sidebar — neither module needs to know about the other.
Sidebar config schema
Standalone groups
If a module should appear as its own top-level dropdown with no sharing, just use its own unique group_id:
Using the sidebar in your admin layout
Or publish and use the bundled layout:
The built sidebar array structure
Flushing the sidebar cache
Disable caching during development:
Module service provider
The generated {Name}ServiceProvider extends BaseModuleServiceProvider:
BaseModuleServiceProvider automatically handles:
| What | From where |
|---|---|
| Migrations | database/migrations/ |
| Views | resources/views/ → account:: |
| Translations | resources/lang/ → account:: |
| Web routes | routes/web.php |
| API routes | routes/api.php |
| Module config | config/config.php → account.* |
Accessing module config
Inter-module communication
Modules should never import classes from each other directly. Use one of:
Events (zero coupling):
Contracts (return values needed):
Customising stubs
Publish the stubs to your project:
Stubs are written to stubs/modular/. The module:make command checks for your custom stubs first before falling back to package defaults.
| Stub file | Generates |
|---|---|
service-provider.stub |
app/Providers/{Name}ServiceProvider.php |
sidebar-config.stub |
config/sidebar.php |
module-config.stub |
config/config.php |
routes-web.stub |
routes/web.php |
routes-api.stub |
routes/api.php |
test-case.stub |
tests/TestCase.php |
PHPUnit test suites
Add a testsuite entry per module in phpunit.xml:
Run a single module's tests:
Configuration reference
config/modules.php
config/modular.php
Changelog
v1.0.0
- Initial release
- Module discovery via
config/modules.php BaseModuleServiceProviderwith auto-registration of migrations, views, routes, config, translations, commandsSidebarManagerwithgroup_idmerging, per-user permission filtering, and cachingphp artisan module:makescaffold command with--forceflag- Publishable config, views, and stubs
License
MIT — see LICENSE
Author
Mehedi Hassan — @mehediishere
Full command reference (v1.1)
Utility
Generators
All generators follow the pattern: php artisan module:make-{type} {ClassName} {Module}
All generators accept --force to overwrite an existing file.
Translation
All versions of laravel-modular with dependencies
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/filesystem Version ^11.0|^12.0|^13.0
illuminate/routing Version ^11.0|^12.0|^13.0
illuminate/cache Version ^11.0|^12.0|^13.0