-
Notifications
You must be signed in to change notification settings - Fork 2
InstallablePackageRecord
Viames Marino edited this page Apr 28, 2026
·
2 revisions
Pair\Packages\InstallablePackageRecord is the abstract base for ActiveRecord models created from installable package manifests.
Use it when creating installable domain models that are tied to package manifests and version compatibility rules.
isCompatibleWithApp(): boolisCompatibleWithAppMajorVersion(): bool- Abstract contract:
getPackageBaseFolder(): stringgetInstallablePackage(): InstallablePackagepackageRecordExists(string $name): boolstoreFromPackageManifest(SimpleXMLElement $options): bool
final class CustomModule extends \Pair\Packages\InstallablePackageRecord {
/**
* Return the folder where this module package installs its files.
*/
public function getPackageBaseFolder(): string
{
return APPLICATION_PATH . '/modules/custom';
}
/**
* Build the installer object for this package record.
*/
public function getInstallablePackage(): \Pair\Packages\InstallablePackage
{
return new \Pair\Packages\InstallablePackage();
}
/**
* Check whether a package record with this name already exists.
*/
public static function packageRecordExists(string $name): bool
{
return false;
}
/**
* Store package-specific values read from manifest options.
*/
public function storeFromPackageManifest(\SimpleXMLElement $options): bool
{
return $this->store();
}
}$module = \Pair\Models\Module::find($id);
if ($module && !$module->isCompatibleWithApp()) {
throw new \RuntimeException('Package is not compatible with this app version');
}- Skipping compatibility checks before enabling a package.
- Mixing package filesystem concerns with controller logic.
See also: InstallablePackage, Module.