Skip to content
docsv0.13.1

PluginRegistryInterface

The plugin activation/installation store, decoupled from any persistence technology. The host implements it over its database; the package ships in-memory and file-backed implementations. Semantics every implementation MUST honor: - enabledNames() MUST NOT throw when the backing store is unavailable — it returns [] (the boot path treats "store down" as "nothing enabled"). - register() throws \RuntimeException when the name is already registered. - save() and setEnabled() throw \RuntimeException when the name is unknown. - unregister() on an unknown name is a no-op (idempotent).

PluginRegistryInterface::enabledNames()

abstract public function enabledNames(): array

Names of all enabled plugins — the ONLY registry read the boot path performs.

PluginRegistryInterface::find()

abstract public function find(string $name): ?Milpa\Plugin\Contracts\PluginRecord

Find one plugin's record by name, or null when not registered.

Parameters

Parameters of find()
NameTypeDescription
$namestring

PluginRegistryInterface::installed()

abstract public function installed(): array

All installed plugins.

PluginRegistryInterface::installedAndEnabled()

abstract public function installedAndEnabled(): array

All plugins that are both installed and enabled.

PluginRegistryInterface::register()

abstract public function register(Milpa\Plugin\Contracts\PluginRecord $record): void

Register a new plugin.

Parameters

Parameters of register()
NameTypeDescription
$recordMilpa\Plugin\Contracts\PluginRecord

Throws

\RuntimeException When a plugin with the same name is already registered.

PluginRegistryInterface::save()

abstract public function save(Milpa\Plugin\Contracts\PluginRecord $record): void

Overwrite an existing plugin's record (keyed by $record->name).

Parameters

Parameters of save()
NameTypeDescription
$recordMilpa\Plugin\Contracts\PluginRecord

Throws

\RuntimeException When the plugin is not registered.

PluginRegistryInterface::setEnabled()

abstract public function setEnabled(string $name, bool $enabled): void

Flip a plugin's enabled flag.

Parameters

Parameters of setEnabled()
NameTypeDescription
$namestring
$enabledbool

Throws

\RuntimeException When the plugin is not registered.

PluginRegistryInterface::unregister()

abstract public function unregister(string $name): void

Remove a plugin from the registry. Unknown name: no-op.

Parameters

Parameters of unregister()
NameTypeDescription
$namestring

PluginRegistryInterface::invalidateActivationCache()

abstract public function invalidateActivationCache(): void

Invalidate every materialized activation cache so the next boot rebuilds from the store. For the host this means BOTH cache files (enabled_plugins.php AND plugins.php); pure implementations no-op.