Repository navigation
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.
Home · Setup · Configuration
Build with Pair 4
- Generator
- Controllers and responses
- Read models
- ActiveRecord and queries
- Forms and validation
- PairUI.js and HTML fragments
APIs and authentication
- API guide and CRUD
- Middleware and rate limits
- Users, sessions, and ACL
- Passkeys and social login
- Native mobile setup
Integrate and operate
- Integrations
- Runtime extensions and adapter keys
- Cache and cache stores
- Logs and observability
- PWA and push
- Packages and distribution
- Upgrade to v4