Some available tools for HMVC Laravel projects.
composer require duyphan2502/hmvc-tools
Update your composer.json
{
...,
"repositories": [
{
"type": "path",
"url": "./platform/core/*"
},
{
"type": "path",
"url": "./platform/plugins/*"
},
{
"type": "path",
"url": "./platform/themes/*"
}
]
}
php artisan module:create <module-name>
For example
php artisan module:create test-module
After you create your module, open the composer.json
file inside your module folder, you can see something like this
{
"name": "plugins/test-module",
"require": {},
"require-dev": {},
"autoload": {
"psr-4": {
"TestModule\\": "src/"
}
},
"extra": [],
"minimum-stability": "dev",
"description": "Test HMVC module"
}
Run this command from terminal
composer require plugins/test-module:*@dev
You might need to register your module provider to config/app.php
If you want Laravel auto register your module, you need to update the module composer.json
{
"name": "plugins/test-module",
"require": {},
"require-dev": {},
"autoload": {
"psr-4": {
"TestModule\\": "src/"
}
},
"extra": [],
"minimum-stability": "dev",
"extra": {
"laravel": {
"providers": [
"TestModule\\Providers\\ModuleServiceProvider"
]
}
},
"description": "Test HMVC module"
}
Don't forget to run composer update
.
Or you can skip these actions easier by adding option --autoload
when you try module:create
php artisan module:create <module-name> --autoload
php artisan module:make:model <module-name> <YourModelName> <your_table_name>
php artisan module:make:controller <module-name> <YourControllerName> --resource
php artisan module:make:migration <module-name> <your_migration_name> {--create=table} {--table=table}
For example
php artisan module:make:migration test-module create_test_table --create=test
php artisan module:make:command <module-name> <YourCommandName>
php artisan module:make:facade <module-name> <YourFacadeName>
php artisan module:make:middleware <module-name> <YourMiddlwareName>
php artisan module:make:provider <module-name> <YourProviderName>
php artisan module:make:request <module-name> <YourRequestName>
php artisan module:make:support <module-name> <YourSupportName>
php artisan module:make:composer <module-name> <YourViewComposerName>
php artisan module:make:provider <module-name> <your-view-name>