jsagot / laravel-modular
Make your Laravel 5.7 application modular
Requires
- php: 7.4.*
- laravel/framework: 6.20.*
This package is auto-updated.
Last update: 2025-06-20 09:26:54 UTC
README
Make your Laravel 6.2 application modular.
About
Modular creates and manages modules for Laravel 6.2. The created modules behave like any package designed for Laravel. With few benefits:
- Autoloaded modules
- Auto registration of middlewares, langs, views and routes (web only)
- Auto-merged configuration file
Installation
Create a new Laravel 6.2 project.
$ composer create-project --prefer-dist laravel/laravel your_project
Install the latest version with
$ composer require jsagot/laravel-modular
Basic Usage
First add ModularServiceProvider to config/app.php
... /* * Package Service Providers... */ Navel\Laravel\Modular\Providers\ModularServiceProvider::class, ...
Publish configuration file:
$ php artisan vendor:publish --provider="Navel\Laravel\Modular\Providers\ModularServiceProvider" --tag="modular.config"
Activate Laravel-Modular
in config/modular.php
return [ 'active' => true, 'path' => 'modules', 'namespace' => 'Modules\\', ];
Create 'modules/' directory
Modules directory should be at the root of your Laravel project.
ex:
- your_project/
- app/
- bootstrap/
- ...
- modules/
Then create a fresh new module :
$ php artisan module:make your_module_name
The default option creates modules in the 'modules/' directory. This will be customizable in future version.
your_module_name should be as simple as possible (DO NOT USE "-_." or any special character. CamelCase works).
You can also create a demo module :
$ php artisan modular:demo
You can then access to http://localhost/demo?demo=demo to see the demo module in action. (See code and comments)