# ConfigApplier

> Applies ordered cookbook calls to fluent component instances.

[API reference](/docs/api/index.md) › [HTML Core](/docs/extensions/html-core/reference/index.md) › [Config](/docs/extensions/html-core/reference/config/index.md) › ConfigApplier

| final readonly class | `UIAwesome\Html\Core\Config\ConfigApplier` |
| --- | --- |
| Implements | [`ConfigApplierInterface`](/docs/extensions/html-core/reference/config/configapplierinterface/index.md) |
| Source | [`src/Config/ConfigApplier.php`](https://github.com/ui-awesome/html-core/blob/main/src/Config/ConfigApplier.php#L20) |

Applies ordered cookbook calls to fluent component instances.

Calls must target public instance methods and return the same component type. Non-strict mode skips unavailable
methods and incompatible return values; exceptions thrown by an invoked method always fail.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`apply()`](#method-apply) | Applies a recipe and returns the configured component instance. | `ConfigApplier` |

## Method details

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

```php
public function apply(object $component, UIAwesome\Html\Core\Config\Recipe $recipe, UIAwesome\Html\Core\Config\ComponentContext $context, bool $strict = true): object
```

Applies a recipe and returns the configured component instance.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$component` | `object` | Component to configure. |
| `$recipe` | [`Recipe`](/docs/extensions/html-core/reference/config/recipe/index.md) | Resolved recipe to apply. |
| `$context` | [`ComponentContext`](/docs/extensions/html-core/reference/config/componentcontext/index.md) | Semantic component context. |
| `$strict` | `bool` | Whether unavailable methods or incompatible return values must fail instead of being skipped. Exceptions thrown by an invoked method always fail, regardless of this flag. |

**Returns**

`object`: Configured component instance.

**Throws**

- [`UIAwesome\Html\Core\Exception\ConfigException`](/docs/extensions/html-core/reference/exception/configexception/index.md): If a call is unavailable or returns an incompatible value in strict mode, or throws during execution in any mode.