Skip to content
docsv0.2.0

ManifestLoader

Reads a `milpa.json` from disk into a uniform {@see VersionManifest}, in BOTH real shapes: - Canonical (012, `capabilities.*` typed records) — passed through core's capability records to validate and normalize, and marked `metadata['shape'] = 'canonical'`. - Legacy (`contracts.*` bare-FQCN lists — the five CRM plugins) — each FQCN synthesized into an unversioned record (`contractVersion 0.0.0` for provides, `constraint *` for requires/suggests, exactly the defaults core's `fromInterface()` applies), moved under `capabilities.*`, and marked `metadata['shape'] = 'legacy-contracts'` — the marker the engine's legacy detector reads. The real extras neither shape resolves yet (`milpa.min-version` / `php-version`, `env-vars`, `dependencies`, `compatibility`, `config`, `assets`, `type`) ride through in `metadata` as honest passthrough — no new value-object fields for data the engine does not consume (spec §25 anti-pattern 5). This layer DOES touch the filesystem (that is its job) but is otherwise deterministic. Every failure — missing file, unreadable file, invalid JSON, a shapeless or field-corrupt manifest — surfaces as an {@see InvalidManifestException} naming the file path and, where known, the offending field.

ManifestLoader::load()

public function load(string $path): Milpa\Resolver\Manifest\VersionManifest

Load and normalize the manifest at `$path`.

Parameters

Parameters of load()
NameTypeDescription
$pathstring

Throws

InvalidManifestException When the file is missing/unreadable, is not valid JSON, or decodes to a structurally invalid manifest.