Skip to content
docsv0.1.0

PluginManifest

Reads and validates a plugin's milpa.json manifest file. This is the primary source of plugin metadata when milpa.json exists. Falls through to #[PluginMetadata] attributes when milpa.json is absent (handled by Plugins::getMetadata()).

PluginManifest::fromPath()

public static function fromPath(string $manifestPath): self

Create a manifest from a milpa.json file path.

Parameters

Parameters of fromPath()
NameTypeDescription
$manifestPathstring

PluginManifest::fromArray()

public static function fromArray(array $data): self

Create a manifest from an array (useful for scaffolding and testing).

Parameters

Parameters of fromArray()
NameTypeDescription
$dataarray<string, mixed>

PluginManifest::generateFromMetadata()

public static function generateFromMetadata(array $metadata, string $namespace, string $entrypoint): array

Generate a milpa.json manifest from existing #[PluginMetadata] attributes.

Parameters

Parameters of generateFromMetadata()
NameTypeDescription
$metadataarray{name?: string, version?: string, author?: string, site?: string, type?: string, provides?: array<string>, requires?: array<string>, suggests?: array<string>}
$namespacestringFull namespace of the plugin class
$entrypointstringPlugin filename (e.g., "MailPlugin.php")

Returns

The manifest data ready to be saved as JSON

PluginManifest::validate()

public function validate(): void

Validate the manifest. Throws on invalid data.

Throws

\InvalidArgumentException If required fields are missing or invalid

PluginManifest::toMetadataArray()

public function toMetadataArray(): array

Convert to the legacy metadata-array shape (`Plugins::$plugins`) that some consumers still read instead of the typed accessors below.

PluginManifest::getName()

public function getName(): string

Vendor/package name (e.g., "acme/mail-plugin").

PluginManifest::getDisplayName()

public function getDisplayName(): string

Human-readable display name (e.g., "Mail Plugin").

PluginManifest::getDescription()

public function getDescription(): string

Short human-readable summary of what the plugin does.

PluginManifest::getVersion()

public function getVersion(): Milpa\ValueObjects\SemanticVersion

PluginManifest::getType()

public function getType(): string

Plugin type: Web, CLI, Mixed, Service.

PluginManifest::getNamespace()

public function getNamespace(): string

PHP namespace (e.g., "Acme\Plugins\ExamplePlugin").

PluginManifest::getEntrypoint()

public function getEntrypoint(): string

Main plugin file relative to plugin directory (e.g., "ExamplePlugin.php").

PluginManifest::getProvides()

public function getProvides(): array

The interfaces/services this plugin provides to the capability system.

PluginManifest::getRequires()

public function getRequires(): array

The interfaces/services this plugin cannot boot without.

PluginManifest::getSuggests()

public function getSuggests(): array

The interfaces/services this plugin can use if available but does not strictly need.

PluginManifest::getProvidedCapabilities()

public function getProvidedCapabilities(): array

Typed `provides` capability records (D7 wiring seam). Reads the canonical `capabilities.provides` key, falling back to legacy `contracts.provides`, and accepts both record arrays and legacy bare-FQCN strings.

PluginManifest::getRequiredCapabilities()

public function getRequiredCapabilities(): array

Typed `requires` capability records (D7 wiring seam).

PluginManifest::getSuggestedCapabilities()

public function getSuggestedCapabilities(): array

Typed `suggests` capability records (D7 wiring seam).

PluginManifest::getComposerDependencies()

public function getComposerDependencies(): array

Composer packages this plugin depends on, beyond the framework itself.

PluginManifest::getPluginDependencies()

public function getPluginDependencies(): array

Other Milpa plugins this plugin depends on.

PluginManifest::getMinMilpaVersion()

public function getMinMilpaVersion(): ?string

The minimum Milpa framework version this plugin requires, or null if unconstrained.

PluginManifest::getPhpVersion()

public function getPhpVersion(): ?string

The PHP version constraint this plugin requires (e.g. ">=8.2"), or null if unconstrained.

PluginManifest::getEnvVars()

public function getEnvVars(): array

Environment variable names the plugin expects to be set.

PluginManifest::getMigrationsDirectory()

public function getMigrationsDirectory(): ?string

Migrations directory name relative to plugin root (e.g., "Migrations").

PluginManifest::getAuthors()

public function getAuthors(): array

The plugin's declared authors.

PluginManifest::getRawData()

public function getRawData(): array

PluginManifest::toJson()

public function toJson(): string

Serialize the manifest data to JSON string for writing to disk.