Skip to content
docsv0.8.0

PluginInterface

The lifecycle contract every Milpa plugin's main class must implement. Plugins are constructed with the framework's {@see DIContainerInterface} and are taken through install/enable/disable/uninstall by the plugins manager, with {@see boot()} run on every enabled plugin during bootstrap.

PluginInterface::__construct()

abstract public function __construct(Milpa\Interfaces\Di\DIContainerInterface $container):

Parameters

Parameters of __construct()
NameTypeDescription
$containerMilpa\Interfaces\Di\DIContainerInterface

PluginInterface::boot()

abstract public function boot(): void

Boots the plugin: registers services, routes, event listeners, etc. Called on every enabled plugin during application bootstrap.

Throws

\Milpa\Exceptions\Plugin\PluginBootException If the plugin fails to boot.

PluginInterface::install()

abstract public function install(): void

Runs one-time setup for the plugin (e.g. migrations, initial config). Called when the plugin is installed.

PluginInterface::uninstall()

abstract public function uninstall(): void

Reverses what {@see install()} did, cleaning up plugin-owned state. Called when the plugin is uninstalled.

PluginInterface::enable()

abstract public function enable(): void

Activates the plugin so it participates in {@see boot()} on future runs.

PluginInterface::disable()

abstract public function disable(): void

Deactivates the plugin without uninstalling it.