Write your own
Module Structure
Section titled “Module Structure”A module is a standard Laravel Service Provider that additionally implements the
Epsicube\Support\Contracts\IsModule interface.
This contract exposes the metadata required by Epsicube 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 module using Laravel’s CLI:
Terminal window php artisan make:module MyCustomModule -
Define Metadata
Section titled “Define Metadata”Open the generated file
app/Modules/MyCustomModule.phpuse Illuminate\Support\ServiceProvider;use Epsicube\Support\Contracts\IsModule;use Epsicube\Support\Modules\Identity;use Epsicube\Support\Modules\Module;class MyCustomModule extends ServiceProvider implements IsModule{public function module(): Module{return Module::make('custom::your-module-identifier', '0.0.1')->providers(static::class)->identity(fn (Identity $identity) => $identity->name('MyCustomModule')->description('')->author('Internal dev'));}//...} -
Register the Module
Section titled “Register the Module”By default, the
module:makecommand registers your module inbootstrap/modules.php.You may also manually create or update the
bootstrap/modules.phpfile:<?phpreturn [//...App\Modules\MyCustomModule::class,]; -
Enable the Module
Section titled “Enable the Module”By default, the
module:makecommand enables your module (unless you use the--disabledoption).You may also enable it manually using:
Terminal window php artisan modules:enable {identifier}
Preventing Laravel Providers
Section titled “Preventing Laravel Providers”When your module needs to disable one or more Laravel package providers, declare them in module(): Module with preventProviders().
use Epsicube\Support\Contracts\IsModule;use Epsicube\Support\Modules\Module;use Illuminate\Support\ServiceProvider;use Vendor\Package\PackageServiceProvider;
class BillingModule extends ServiceProvider implements IsModule{ public function module(): Module { return Module::make('app::billing', '1.0.0') ->providers(static::class) ->preventProviders(PackageServiceProvider::class); }}During application bootstrap, Epsicube updates Laravel’s package manifest before providers are registered. Any provider declared through preventProviders() is excluded from Laravel’s discovered provider list for that boot cycle.
Use this when your module replaces a package integration, needs to avoid duplicate bindings, or must prevent a conflicting package provider from loading.
Related Laravel Documentation
Section titled “Related Laravel Documentation”- Package Development — Learn how to create reusable packages with configuration, migrations, assets, and service providers.