This package gives you the ability to use Laravel 6 with module system. You can simply drop or generate modules with their own controllers, models, views, translations and a routes file into the app/Modules
folder and go on working with them.
"This package originally created by artem-schander", I just modified some code and implement for Laravel 6
. Thanks.
- Installation
- Getting started
- Usage
The best way to install this package is through your terminal via Composer.
Run the following command from your projects root
composer require devhridoy/l6modular
Once this operation is complete, simply add the service provider to your project's config/app.php and you're done.
Devhridoy\L6modular\ModuleServiceProvider::class
The built in Artisan command php artisan make:module name [--no-migration] [--no-translation]
generates a ready to use module in the app/Modules
folder and a migration/translation if necessary.
Since version 1.3.0 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 ├── routes │ ├── api.php │ └── web.php └── helper.php
The generated RESTful Resource Controller
and the corresponding routes/web.php
make it easy to dive in. In my example you would see the output from the Modules/FooBar/Views/index.blade.php
by opening laravel-project:8000/foo-bar
in your browser.
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
.
L6 Modular is licensed under the terms of the MIT License (See LICENSE file for details).