The Skeleton module serves as a template for creating new modules in the system. It provides a streamlined structure and a convenient command-line tool to quickly generate new modules based on this skeleton.
You can install the package via composer:
composer require e2tmk/skeleton-module
- PHP >= 8.2
- Laravel >= 11.0
- nwidart/laravel-modules >= 9.0
The Skeleton module contains a basic structure that follows best practices for module development:
- Configuration files
- Service provider setup
- Basic directory structure
- Composer configuration
- Module manifest
The Skeleton module includes a powerful command-line tool called module-build
that helps you quickly create new modules based on this template.
You can create a new module using the command:
php artisan module-build
Or specify the module name directly with the --name
option:
php artisan module-build --name=MyNewModule
The module-build
command performs the following operations:
- Creates a new module directory based on the provided name
- Copies all files from the Skeleton module to the new module
- Renames files and directories by replacing "Skeleton" with your module name
- PascalCase substitution: "Skeleton" β "YourModuleName"
- Lowercase substitution: "skeleton" β "yourmodulename"
- Updates file contents to replace all occurrences of "Skeleton" with your module name
- Updates specific files:
composer.json
: Updates package name and namespacesmodule.json
: Updates name, alias, and provider paths- Service Provider: Updates namespace, class name, and properties
- Cleans up:
- Removes
.git
directory if it exists - Removes
vendor
directory if it exists - Removes the
ModuleBuildCommand
from the new module
- Removes
- Registers the module:
- Updates
modules_statuses.json
to enable the new module
- Updates
- Updates autoloader:
- Runs
composer dump-autoload
to register the new namespaces
- Runs
Once your new module is created, it will be:
- Properly registered in the system
- Ready for development
- Accessible through its namespace (
Modules\YourModuleName
)
You can then start adding your specific functionality to the new module!
- Use the module-build command to ensure consistency across all modules
- Maintain the standard directory structure for new modules
- Follow the naming conventions established by the Skeleton module
To create a new "Reports" module:
php artisan module-build --name=Reports
This will create a fully functional Reports module with all necessary files and configurations.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.
If you discover any issues or have questions, please open an issue on GitHub.