# ManifestSchema

> Validates a provider manifest and normalises it into typed copy, exclude, modes and merge entries.

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

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

Validates a provider manifest and normalises it into typed `copy`, `exclude`, `modes` and `merge` entries.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`validate()`](#method-validate) | Validates a raw decoded manifest array and returns the typed structure. | `ManifestSchema` |

## Method details

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

```php
public function validate(mixed[] $raw, bool $inline = false): array{copy: list<array{from: string, to: string}>, exclude: list<string>, modes: array<array-key, PHPForge\Scaffold\Manifest\FileMode>, merge: array<array-key, PHPForge\Scaffold\Merge\MergeStrategyKind>}
```

Validates a raw decoded manifest array and returns the typed structure.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$raw` | `mixed[]` | Decoded JSON content of the manifest (or the inline `extra.scaffold` array). |
| `$inline` | `bool` | `true` when `$raw` is the inline `extra.scaffold` block, which may also carry the consumer-side keys `manifest`, `allowed-packages` and `auto`. |

**Returns**

`array{copy: list<array{from: string, to: string}>, exclude: list<string>, modes: array<array-key,` [`FileMode`](/docs/extensions/scaffold/reference/manifest/filemode/index.md)`>, merge: array<array-key,` [`PHPForge\Scaffold\Merge\MergeStrategyKind`](/docs/extensions/scaffold/reference/merge/mergestrategykind/index.md)`>}`: Typed manifest with `copy[]` entries normalised to `{from, to}` form, `modes` values resolved to [`FileMode`](/docs/extensions/scaffold/reference/manifest/filemode/index.md) cases and `merge` values resolved to [`MergeStrategyKind`](/docs/extensions/scaffold/reference/merge/mergestrategykind/index.md) cases.

**Throws**

- [`RuntimeException`](https://www.php.net/manual/en/class.runtimeexception.php): when the manifest structure is invalid or contains an unknown key.