ManifestLoader
API reference › Scaffold › Manifest › ManifestLoader
Loads a provider manifest, inline in extra.scaffold or in the provider file named by extra.scaffold.manifest, and
expands it into file mappings.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Creates a loader with its schema validator and mapping expander. | ManifestLoader |
loadFromExtra() | Loads the provider manifest from the extra section of a provider package and expands it into file mappings, without Composer’s package classes. | ManifestLoader |
loadFromPath() | Loads the provider manifest from the composer.json at the provider root and expands it into file mappings, exactly like ManifestLoader::loadFromExtra(). | ManifestLoader |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(PHPForge\Scaffold\Manifest\ManifestSchema $schema, PHPForge\Scaffold\Manifest\ManifestExpander $expander)Creates a loader with its schema validator and mapping expander.
Parameters
| Parameter | Type | Description |
|---|---|---|
$schema | ManifestSchema | Validates the manifest. |
$expander | ManifestExpander | Expands the validated manifest into file mappings. |
loadFromExtra()
Section titled “loadFromExtra() ”public function loadFromExtra(mixed[] $extra, string $packageName, string $packagePath): list<PHPForge\Scaffold\Manifest\FileMapping>Loads the provider manifest from the extra section of a provider package and expands it into file mappings,
without Composer’s package classes.
Parameters
| Parameter | Type | Description |
|---|---|---|
$extra | mixed[] | extra section of the provider package. |
$packageName | string | Composer package name of the provider. |
$packagePath | string | Absolute path to the provider root. |
Returns
list<FileMapping>: File mappings; empty when $extra declares no scaffold object.
Throws
RuntimeException: when the manifest file is missing or unreadable, the manifest is invalid, or acopy[]path does not exist.JsonException: when the external manifest file is not valid JSON.
loadFromPath()
Section titled “loadFromPath() ”public function loadFromPath(string $packageName, string $packagePath): list<PHPForge\Scaffold\Manifest\FileMapping>Loads the provider manifest from the composer.json at the provider root and expands it into file mappings,
exactly like ManifestLoader::loadFromExtra().
Parameters
| Parameter | Type | Description |
|---|---|---|
$packageName | string | Composer package name of the provider. |
$packagePath | string | Absolute path to the provider root. |
Returns
list<FileMapping>: File mappings; empty when the package declares no extra.scaffold object.
Throws
RuntimeException: when the providercomposer.jsonor the manifest file is missing, unreadable or invalid, or acopy[]path does not exist.JsonException: when the providercomposer.jsonor the external manifest file is not valid JSON.