Skip to content
This documentation is in construction.

Declare integrations

Integrations let modules interact and extend each other safely.

They allow you to register behavior or resources that execute only when a target module is enabled, with optional fallback when the module is disabled.


  1. Your module must implement the Epsicube\Support\Contracts\HasIntegrations interface.

    use Epsicube\Support\Contracts\HasIntegrations;
    use Epsicube\Support\Integrations;
    class YourModule extends ServiceProvider implements HasIntegrations, Module
    {
    // ...
    public function integrations(): Integrations
    {
    return Integrations::make()->forModule(
    identifier: 'core::execution-platform',
    whenEnabled: function() {
    // Callback executed only when the target module is enabled
    Workflows::register(YourModuleWorkflow::make());
    },
    whenDisabled: function() {
    // Optional callback executed if the target module is disabled
    }
    );
    }
    }
  2. When defining an integration with another module, you provide a set of parameters that control how your module interacts with the target module.

    ParameterDescription
    identifierThe unique identifier of the target module you want to integrate with.
    whenEnabledA closure executed only when the target module is enabled.
    Use it to extend functionality or interact with the module’s APIs.
    whenDisabledAn optional closure executed only when the target module is disabled.
    • Always guard integration callbacks against missing or disabled modules.
    • Keep integration logic modular to prevent side effects on other modules.