# MapFrom

> Maps a model property from an explicit input key.

[API reference](/docs/api/index.md) › [Model](/docs/extensions/model/reference/index.md) › [Attribute](/docs/extensions/model/reference/attribute/index.md) › MapFrom

| final readonly class | `UIAwesome\Model\Attribute\MapFrom` |
| --- | --- |
| Source | [`src/Attribute/MapFrom.php`](https://github.com/ui-awesome/model/blob/main/src/Attribute/MapFrom.php#L16) |

Maps a model property from an explicit input key.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-key"></span>`$key` readonly | `string` | Identifies the external input key mapped to this property. | `MapFrom` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Configures the external input key. | `MapFrom` |

## Method details

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

```php
public function __construct(string $key)
```

Configures the external input key.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$key` | `string` | Nonempty input key. |

**Throws**

- [`InvalidArgumentException`](https://www.php.net/manual/en/class.invalidargumentexception.php): When the key is empty.