Skip to content
This documentation is in construction.

Adding Dependencies

Dependencies allow a module to require other modules to be enabled and within a compatible version before it can function.

This ensures that your module operates in a stable environment where its prerequisites are met.

By declaring dependencies, you can:

  • Guarantee that shared functionality or services provided by other modules are available.
  • Prevent fatal errors or misbehavior caused by missing components.
  • Control the activation order of modules in a predictable way.

  1. Your module must import the Epsicube\Support\Modules\Dependencies class.

    use Illuminate\Support\ServiceProvider;
    use Epsicube\Support\Contracts\IsModule;
    use Epsicube\Support\Modules\{Module,Dependencies};
    class BrandingModule extends ServiceProvider implements IsModule
    {
    // ...
    public function module(): Module
    {
    return Module::make('custom::mycustommodule', '0.0.1')
    //...
    ->dependencies(function(Dependencies $dependencies) {
    $dependencies->module('target-module', '^2.0');
    $dependencies->module('target-module2', '*'); // Any version (default)
    });
    }
    }
  2. The versioning system follows the Semver format, exactly like Composer. You can use the full range of version constraints:

    • 1.2.3: An exact version.
    • ^1.2: Any version greater than or equal to 1.2.0 and less than 2.0.0.
    • >=5.0 <6.0: A specific range of versions.
    • *: Any available version.