# ManifestExpander

> Expands a validated manifest into file mappings; a later copy[] entry overrides an earlier one per destination.

[API reference](/docs/api/index.md) › [Scaffold](/docs/extensions/scaffold/reference/index.md) › [Manifest](/docs/extensions/scaffold/reference/manifest/index.md) › ManifestExpander

| final class | `PHPForge\Scaffold\Manifest\ManifestExpander` |
| --- | --- |
| Source | [`src/Manifest/ManifestExpander.php`](https://github.com/php-forge/scaffold/blob/main/src/Manifest/ManifestExpander.php#L34) |

Expands a validated manifest into file mappings; a later `copy[]` entry overrides an earlier one per destination.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`expand()`](#method-expand) | Expands a validated manifest into the list of file mappings that the scaffolder must apply. | `ManifestExpander` |

## Method details

### expand() <span id="method-expand"></span>

```php
public function expand(PHPForge\Scaffold\Manifest\ValidatedManifest $manifest, string $providerPath, string $providerName): list<PHPForge\Scaffold\Manifest\FileMapping>
```

Expands a validated manifest into the list of file mappings that the scaffolder must apply.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$manifest` | `PHPForge\Scaffold\Manifest\ValidatedManifest` | Validated manifest as returned by [`ManifestSchema::validate()`](/docs/extensions/scaffold/reference/manifest/manifestschema/index.md#method-validate). |
| `$providerPath` | `string` | Absolute path to the provider root on disk. |
| `$providerName` | `string` | Composer package name (used to attribute the mapping for provenance). |

**Returns**

`list<`[`FileMapping`](/docs/extensions/scaffold/reference/manifest/filemapping/index.md)`>`: Concrete list of mappings, ready for the scaffolder.

**Throws**

- [`RuntimeException`](https://www.php.net/manual/en/class.runtimeexception.php): when a path listed in `copy[]` does not exist on disk.