Skip to content

InstallablePackage

Viames Marino edited this page Apr 28, 2026 · 2 revisions

Pair framework: InstallablePackage

Pair\Packages\InstallablePackage manages ZIP package lifecycle: manifest creation, archive download, archive validation, file installation, and package record creation.

The official name for this extension style is Installable Package.

This is the ZIP/manifest package installer surface. Runtime Extensions should use RuntimeExtensionInterface and explicit registration instead.

When to use

Use InstallablePackage when installing or downloading module, template, provider, or custom packages that follow Pair manifest conventions.

Main methods

  • installArchive(string $archivePath): bool
  • downloadArchive(): void
  • writeManifestFile(): bool
  • __get(...), __set(...) for package metadata access

Implementation examples

Local package install

$package = new \Pair\Packages\InstallablePackage();

if (!$package->installArchive('my-module.zip')) {
    throw new \RuntimeException('Package installation failed');
}

Remote download + install flow

$package = new \Pair\Packages\InstallablePackage();
$package->name = 'my-module';
$package->version = '1.2.0';
$package->downloadArchive();

$ok = $package->installArchive('my-module-1.2.0.zip');

Manifest generation

$package = new \Pair\Packages\InstallablePackage(
    'Module',
    'customer-portal',
    '1.2.0',
    '2026-04-23',
    '4.0',
    APPLICATION_PATH . '/modules/customer-portal'
);

if (!$package->writeManifestFile()) {
    throw new \RuntimeException('Package manifest could not be written.');
}

Common pitfalls

  • Invalid manifest structure leads to partial installation.
  • Version compatibility should be checked before activation.

See also: RuntimeExtensionInterface, AdapterRegistry, InstallablePackageRecord, Module, Template.

Clone this wiki locally