# FileMapping

> Represents one provider file to apply: its source, destination, write mode and merge strategy.

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

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

Represents one provider file to apply: its source, destination, write mode and merge strategy.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-destination"></span>`$destination` readonly constructor | `string` | Destination path relative to the project root, using forward slashes. | `FileMapping` |
| <span id="property-mergeStrategy"></span>`$mergeStrategy` readonly constructor | [`PHPForge\Scaffold\Merge\MergeStrategyKind`](/docs/extensions/scaffold/reference/merge/mergestrategykind/index.md)`\|null` | Merge strategy declared by the manifest `merge` map for the `append` mode, or `null` to resolve it from the destination basename. Default: `null`. | `FileMapping` |
| <span id="property-mode"></span>`$mode` readonly constructor | [`FileMode`](/docs/extensions/scaffold/reference/manifest/filemode/index.md) | Write mode applied to the destination. | `FileMapping` |
| <span id="property-providerName"></span>`$providerName` readonly constructor | `string` | Composer package name of the provider. | `FileMapping` |
| <span id="property-providerPath"></span>`$providerPath` readonly constructor | `string` | Absolute path to the provider root on disk. | `FileMapping` |
| <span id="property-source"></span>`$source` readonly constructor | `string` | Source path relative to the provider root, using forward slashes. | `FileMapping` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a provider file mapping. | `FileMapping` |

## Method details

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

```php
public function __construct(string $destination, string $source, PHPForge\Scaffold\Manifest\FileMode $mode, string $providerName, string $providerPath, PHPForge\Scaffold\Merge\MergeStrategyKind|null $mergeStrategy = null)
```

Creates a provider file mapping.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$destination` | `string` | Destination path relative to the project root, using forward slashes. |
| `$source` | `string` | Source path relative to the provider root, using forward slashes. |
| `$mode` | [`FileMode`](/docs/extensions/scaffold/reference/manifest/filemode/index.md) | Write mode applied to the destination. |
| `$providerName` | `string` | Composer package name of the provider. |
| `$providerPath` | `string` | Absolute path to the provider root on disk. |
| `$mergeStrategy` | [`PHPForge\Scaffold\Merge\MergeStrategyKind`](/docs/extensions/scaffold/reference/merge/mergestrategykind/index.md)`\|null` | Merge strategy declared by the manifest `merge` map for the `append` mode, or `null` to resolve it from the destination basename. |