Write your own
Module Structure
Section titled “Module Structure”A module is a standard Laravel Service Provider that additionally implements the
Epsicube\Support\Contracts\Module interface.
This contract provides the metadata Epsicube needs to register, identify, and manage your module.
How to create a module ?
Section titled “How to create a module ?”-
Create a Service Provider
Section titled “Create a Service Provider”Generate a new provider using Laravel’s CLI:
Terminal window php artisan make:provider MyCustomModule -
Implement the Module Contract
Section titled “Implement the Module Contract”Update the provider to implement the
Moduleinterface:use Illuminate\Support\ServiceProvider;use Epsicube\Support\Contracts\Module;use Epsicube\Support\ModuleIdentity;class MyCustomModule extends ServiceProvider implements Module{public function identifier(): string{return 'my-custom-module';}public function identity(): ModuleIdentity{return ModuleIdentity::make(name: __('Your custom module'),version: 'dev-master',author: 'Your Team',description: '' // Optional);}// ... register()// ... boot()} -
Register the Module
Section titled “Register the Module”Epsicube does not use Laravel’s default provider registration system.
Remove the provider from:
bootstrap/providers.php- or
config/app.php → providers
Instead, register it in your module’s
composer.json:"extra": {"epsicube": {"modules": ["App\\Providers\\MyCustomModule"]}} -
Refresh composer cache
Section titled “Refresh composer cache”Terminal window composer dump-autoload -
Enable your module
Section titled “Enable your module”- Using the administration, or using the cli:
Terminal window php artisan modules:enable my-custom-module # Use the specified identifier
Related Laravel Documentation
Section titled “Related Laravel Documentation”- Package Development — Learn how to create reusable packages with configuration, migrations, assets, and service providers.