# AssetFallback

> Restores an asset manifest to the state captured before dependency solving.

[API reference](/docs/api/index.md) › [Foxy](/docs/extensions/foxy/reference/index.md) › [Fallback](/docs/extensions/foxy/reference/fallback/index.md) › AssetFallback

| final class | `Foxy\Fallback\AssetFallback` |
| --- | --- |
| Implements | [`FallbackInterface`](/docs/extensions/foxy/reference/fallback/fallbackinterface/index.md) |
| Source | [`src/Fallback/AssetFallback.php`](https://github.com/php-forge/foxy/blob/main/src/Fallback/AssetFallback.php#L19) |

Restores an asset manifest to the state captured before dependency solving.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a fallback for one asset manifest path. | `AssetFallback` |
| [`restore()`](#method-restore) | Restores the captured manifest, or removes it when Foxy created it. | `AssetFallback` |
| [`save()`](#method-save) | Captures the current manifest state when asset fallback is enabled. | `AssetFallback` |

## Method details

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

```php
public function __construct(Composer\IO\IOInterface $io, Foxy\Config\Config $config, string $path, Composer\Util\Filesystem|null $fs = null)
```

Creates a fallback for one asset manifest path.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$io` | `Composer\IO\IOInterface` | Composer I/O used to report restoration. |
| `$config` | [`Foxy\Config\Config`](/docs/extensions/foxy/reference/config/config/index.md) | Foxy configuration controlling asset fallback. |
| `$path` | `string` | Asset manifest path to snapshot. |
| `$fs` | `Composer\Util\Filesystem\|null` | Filesystem implementation, or `null` to create the Composer default. |

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

```php
public function restore(): void
```

Restores the captured manifest, or removes it when Foxy created it.

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

```php
public function save(): self
```

Captures the current manifest state when asset fallback is enabled.

**Returns**

`self`