Skip to content
docsv0.13.1

PluginInstaller

Plugin install/update/remove pipeline, port-shaped: the source of the code speaks {@see PluginDownloaderInterface}, the activation store speaks {@see PluginRegistryInterface}, migrations run through the v2 {@see PluginMigrationRunner}, and composer requires go through {@see ComposerRunnerInterface} — a failed or invalid package spec ABORTS the installation (never the legacy log-and-continue).

PluginInstaller::__construct()

public function __construct(Milpa\Interfaces\Di\DIContainerInterface $container, Milpa\Plugin\Contracts\PluginRegistryInterface $registry, Milpa\Plugin\PluginMigrationRunner $migrationRunner, Milpa\Plugin\Contracts\ComposerRunnerInterface $composerRunner, Milpa\Plugin\Contracts\PluginDownloaderInterface $downloader, Milpa\Plugin\DependencyResolver $resolver, Milpa\Plugin\LockFileManager $lockManager, string $rootPath):

Parameters

Parameters of __construct()
NameTypeDescription
$containerMilpa\Interfaces\Di\DIContainerInterface
$registryMilpa\Plugin\Contracts\PluginRegistryInterface
$migrationRunnerMilpa\Plugin\PluginMigrationRunner
$composerRunnerMilpa\Plugin\Contracts\ComposerRunnerInterface
$downloaderMilpa\Plugin\Contracts\PluginDownloaderInterface
$resolverMilpa\Plugin\DependencyResolver
$lockManagerMilpa\Plugin\LockFileManager
$rootPathstring

PluginInstaller::setOutputCallback()

public function setOutputCallback(callable $callback): void

Set a callback for output messages during installation.

Parameters

Parameters of setOutputCallback()
NameTypeDescription
$callbackcallable(string $message, string $type): void

PluginInstaller::require()

public function require(string $source): Milpa\DTO\PluginInstallResult

Install a plugin from a remote source (GitHub). Flow: 1. Parse source → owner, repo, constraint 2. Query GitHub API → find matching release 3. Download and extract zipball 4. Read milpa.json → validate 5. Resolve dependencies (Composer + plugins) 6. Install Composer packages through the composer port — a failed or invalid package spec ABORTS before any file or registry change 7. Copy to plugins/ directory 8. Register in the activation store + run install() 9. Run migrations 10. Update milpa.lock

Parameters

Parameters of require()
NameTypeDescription
$sourcestring

PluginInstaller::update()

public function update(string $pluginName, ?string $targetVersion = null): Milpa\DTO\PluginInstallResult

Update an installed plugin to the latest compatible version.

Parameters

Parameters of update()
NameTypeDescription
$pluginNamestring
$targetVersion?string

PluginInstaller::resolve()

public function resolve(string $source): Milpa\DTO\DependencyResolution

Resolve plugin and Composer dependencies for a remote source without installing it. Mirrors steps 1-5 of {@see require()} (parse source, resolve version, download, read manifest, resolve dependencies) but never copies files, touches the activation store, or updates milpa.lock — the extracted download is always cleaned up before returning.

Parameters

Parameters of resolve()
NameTypeDescription
$sourcestring

PluginInstaller::remove()

public function remove(string $pluginName, bool $keepData = false): Milpa\DTO\PluginRemoveResult

Remove a remotely-installed plugin.

Parameters

Parameters of remove()
NameTypeDescription
$pluginNamestring
$keepDatabool

PluginInstaller::checkOutdated()

public function checkOutdated(): array

Check if updates are available for installed remote plugins.