Skip to content
docsv0.7.1

InstalledCapabilityLoader

What the INSTALLED DISTRIBUTIONS provide, as graph input — the crossing of the two graphs (P17.4). ── WHAT WAS DISCONNECTED ─────────────────────────────────────────────────────────────────────── `ResolutionInput` has taken `capabilityProvisions` since it existed, and every caller passed `[]`. With that, the architecture graph only ever saw PLUGINS. An app could depend on a distribution —in the host this was written for, nine plugins import `Milpa\ToolRuntime\`— and the graph had no way of knowing whether the package was installed. The capability→package table held the answer and nobody asked it the question, so its `install-package` recommendation could never fire. Two graphs that never meet is also why the vocabularies drifted for months without anyone noticing: nothing ever compared them. ── THE PACKAGE IS THE AUTHORITY, AND `installed.json` IS ITS RECORD ──────────────────────────── A distribution declares its own capability in `extra.milpa.capability`, and Composer copies that declaration verbatim into `vendor/composer/installed.json` at install time. Reading it there —and not by probing for classes— means a package that is present but broken still reads as present, and a package that is absent reads as absent, with no guessing in between. ── AN ID WITHOUT A DECLARED CONTRACT IS SKIPPED, NOT INVENTED ────────────────────────────────── A provision needs the contract it fulfils, and only the package can say which one: it comes from `extra.milpa.capability.contracts`, an `id → FQCN` map. A package name is not an interface, so an id with no declared contract is **left out**. The result is a graph that knows less — which is honest — instead of one that asserts more than anybody declared.

InstalledCapabilityLoader::fromVendor()

public static function fromVendor(string $vendor): array

What the installed distributions declare they provide, as graph input.

Parameters

Parameters of fromVendor()
NameTypeDescription
$vendorstringthe vendor root to read `composer/installed.json` from

Returns

empty when there is no `installed.json`: "I could not know" is not the same as "nothing is installed", and the caller that needs the difference asks the filesystem, not this