# AssetManagerFinder

> Selects a configured asset manager by name, lock file, or executable availability.

[API reference](/docs/api/index.md) › [Foxy](/docs/extensions/foxy/reference/index.md) › [Asset](/docs/extensions/foxy/reference/asset/index.md) › AssetManagerFinder

| final class | `Foxy\Asset\AssetManagerFinder` |
| --- | --- |
| Source | [`src/Asset/AssetManagerFinder.php`](https://github.com/php-forge/foxy/blob/main/src/Asset/AssetManagerFinder.php#L14) |

Selects a configured asset manager by name, lock file, or executable availability.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Registers the asset managers available for selection. | `AssetManagerFinder` |
| [`addManager()`](#method-addManager) | Registers an asset manager by its unique name. | `AssetManagerFinder` |
| [`findManager()`](#method-findManager) | Find the asset manager. | `AssetManagerFinder` |

## Method details

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

```php
public function __construct(Foxy\Asset\AssetManagerInterface[] $managers = [])
```

Registers the asset managers available for selection.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$managers` | [`AssetManagerInterface`](/docs/extensions/foxy/reference/asset/assetmanagerinterface/index.md)`[]` | The asset managers |

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

```php
public function addManager(Foxy\Asset\AssetManagerInterface $manager): void
```

Registers an asset manager by its unique name.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$manager` | [`AssetManagerInterface`](/docs/extensions/foxy/reference/asset/assetmanagerinterface/index.md) |  |

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

```php
public function findManager(string|null $manager = null, bool $checkAvailability = true): Foxy\Asset\AssetManagerInterface
```

Find the asset manager.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$manager` | `string\|null` | The name of the asset manager |
| `$checkAvailability` | `bool` | Whether to check automatically selected manager availability |

**Returns**

[`AssetManagerInterface`](/docs/extensions/foxy/reference/asset/assetmanagerinterface/index.md)

**Throws**

- [`Foxy\Exception\RuntimeException`](/docs/extensions/foxy/reference/exception/runtimeexception/index.md): When the asset manager does not exist
- [`Foxy\Exception\RuntimeException`](/docs/extensions/foxy/reference/exception/runtimeexception/index.md): When the asset manager is not found