Adding Dependencies
Dependencies allow a module to require other modules to be enabled before it can function. This ensures that your module only operates in an environment where its prerequisites are met.
By declaring dependencies, you can:
- Guarantee that shared functionality or services provided by other modules are available.
- Prevent errors or misbehavior caused by missing modules.
- Control the activation order of modules in a predictable way.
Dependencies are checked automatically when enabling modules via the Administration interface or CLI commands, ensuring that all requirements are satisfied before a module becomes active.
How to add dependencies ?
Section titled “How to add dependencies ?”-
Implement the Interface
Section titled “Implement the Interface”Your module must implement the
Epsicube\Support\Contracts\HasDependenciesinterface.use Epsicube\Support\Contracts\HasDependencies;use Epsicube\Support\Dependencies;class BrandingModule extends ServiceProvider implements HasDependencies, Module{// ...public function dependencies(): Dependencies{return Dependencies::make('core::execution-platform', 'core::administration');}} -
Understand Constraints
Section titled “Understand Constraints”