Skip to content
PHP Ecosystem
Explore

ManifestLoader

API reference › Scaffold › Manifest › ManifestLoader

final readonly classPHPForge\Scaffold\Manifest\ManifestLoader
Sourcesrc/Manifest/ManifestLoader.php

Loads a provider manifest, inline in extra.scaffold or in the provider file named by extra.scaffold.manifest, and expands it into file mappings.

MethodDescriptionDefined 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
public function __construct(PHPForge\Scaffold\Manifest\ManifestSchema $schema, PHPForge\Scaffold\Manifest\ManifestExpander $expander)

Creates a loader with its schema validator and mapping expander.

Parameters

ParameterTypeDescription
$schemaManifestSchemaValidates the manifest.
$expanderManifestExpanderExpands the validated manifest into file mappings.
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

ParameterTypeDescription
$extramixed[]extra section of the provider package.
$packageNamestringComposer package name of the provider.
$packagePathstringAbsolute 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 a copy[] path does not exist.
  • JsonException: when the external manifest file is not valid JSON.
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

ParameterTypeDescription
$packageNamestringComposer package name of the provider.
$packagePathstringAbsolute path to the provider root.

Returns

list<FileMapping>: File mappings; empty when the package declares no extra.scaffold object.

Throws

  • RuntimeException: when the provider composer.json or the manifest file is missing, unreadable or invalid, or a copy[] path does not exist.
  • JsonException: when the provider composer.json or the external manifest file is not valid JSON.