-
Notifications
You must be signed in to change notification settings - Fork 2
PluginBase
Viames Marino edited this page Feb 23, 2026
·
1 revision
Pair\Helpers\PluginBase is the abstract base for plugin-backed ActiveRecord models.
Use it when creating installable domain models that are tied to plugin manifests and version compatibility rules.
isCompatibleWithApp(): boolisCompatibleWithAppMajorVersion(): bool- Abstract contract:
getBaseFolder(): stringgetPlugin(): PluginstoreByPlugin(SimpleXMLElement $options): bool
final class CustomModule extends \Pair\Helpers\PluginBase {
public function getBaseFolder(): string
{
return APP_PATH . '/modules/custom';
}
public function getPlugin(): \Pair\Helpers\Plugin
{
return new \Pair\Helpers\Plugin();
}
public function storeByPlugin(\SimpleXMLElement $options): bool
{
return $this->store();
}
}$module = \Pair\Models\Module::find($id);
if ($module && !$module->isCompatibleWithApp()) {
throw new RuntimeException('Plugin is not compatible with this app version');
}- Skipping compatibility checks before enabling a plugin.
- Mixing plugin filesystem concerns with controller logic.