tienhm7 / laravel-hmvc-generator
this package which created to manage your large by modules using HMVC architectural pattern
v1.0.0
2022-07-06 03:02 UTC
Requires
- php: >=7.4
Conflicts
- laravel/laravel: <8.0
This package is auto-updated.
Last update: 2024-11-06 08:05:33 UTC
README
HMVC_Generator
A Laravel package to create and manage your large laravel app using modules [HMVC]
Folder Structure
- Modules
- User
- Config/
- Database/
- Migrations/
- Http/
- Controllers/
- UserController.php
- Middleware/
- UserMiddleware.php
- Requests/
- UserRequest.php
- Controllers/
- Models/
- User.php
- Providers/
- UserServiceProvider.php
- Lang/
- en/
- vi/
- Views/
- index.blade.php
- Routes/
- web.php "All Routes under "users" prefix"
- api.php "All Routes under "api/users" prefix"
- User
Artisan Commands
- To create a new module you can simply run :
php artisan module:make <module_name>
- Create new Controller for the specified module :
php artisan module:make-controller <controller_name> --module=<module_name>
- Create new Model for the specified module :
php artisan module:make-model <model_name> --module=<module_name>
- Create new Middleware for the specified module :
php artisan module:make-middleware <middleware_name> --module=<module_name>
- Create new Request for the specified module :
php artisan module:make-request <request_name> --module=<module_name>
- Create new Migration for the specified module :
php artisan module:make-migration <migration_name> --module=<module_name> --table=<table_name>
// Example:
php artisan module:make-migration create_posts_table --module=Post
Routes
api.php => These routes are loaded by the <module_name>ServiceProvider within a group which is assigned the "api" middleware group and "api/<module_name>" prefix
web.php => These routes are loaded by the <module_name>ServiceProvider within a group which contains the "web" middleware group and "<module_name>" prefix.
Views
Calling View: view('<module_name>::view_file_name')
You need to add module service provider to the list of providers in the config/app.php file and run
composer dump-autoload