| Package Data | |
|---|---|
| Maintainer Username: | hsameerc |
| Maintainer Contact: | im@hsameer.com.np (Sameer Humagain) |
| Package Create Date: | 2016-07-22 |
| Package Last Update: | 2016-07-22 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-22 15:10:18 |
| Package Statistics | |
|---|---|
| Total Downloads: | 1,376 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 1 |
| Total Watchers: | 1 |
| Total Forks: | 0 |
| Total Open Issues: | 1 |
The best way to install this package is through your terminal via Composer.
Add the following line to the composer.json file and fire composer update
"hsameerc/laravel-modular-structure": "dev-master"
Once this operation is complete, simply add the service provider to your project's config/app.php
Hsameerc\LaravelModularStructure\ModuleServiceProvider::class,
The built in Artisan command php artisan make:module name [--migration] [--translation] generates a ready to use module in the app/Modules folder and a migration if necessary.
You can generate modules named with more than one word, like foo-bar.
This is how the generated module would look like:
laravel-project/
app/
|-- Modules/
|-- FooBar/
|-- Controllers/
|-- FooBarController.php
|-- Models/
|-- FooBar.php
|-- Views/
|-- index.blade.php
|-- Translations/
|-- en/
|-- example.php
|-- Requests/
|-- FooBarRequest.php
|-- routes.php
|-- helper.php
The generated RESTful Resource Controller and the corresponding routes.php make it easy to dive in. In my example you would see the output from the Modules/FooBar/Views/index.blade.php when you open laravel-project:8000/foo-bar in your browser.
In case you want to disable one ore more modules, you can add a modules.php into your projects app/config folder. This file should return an array with the module names that should be loaded.
F.a:
return [
'enable' => array(
"customer",
"jobs",
"reporting",
),
];
In this case LaravelModularStructure would only load this three modules customer jobs reporting. Every other module in the app/Modules folder would not be loaded.
Laravel Modular Structure will load all modules if there is no modules.php file in the config folder.
You have to follow the upper camel case name convention for the module folder. If you had a Modules/foo folder you have to rename it to Modules/Foo.
Also there are changes in the app/config/modules.php file. Now you have to return an array with the key enable instead of list.
Laravel Modular Structure is licensed under the terms of the MIT License (See LICENSE file for details).