# DebugArray

> Represents a PHP array with arbitrary nested values as JSON-safe debug data.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Storage](/docs/extensions/debug-core/reference/storage/index.md) › DebugArray

| final readonly class | `PHPForge\Debug\Storage\DebugArray` |
| --- | --- |
| Implements | [`JsonSerializable`](https://www.php.net/manual/en/class.jsonserializable.php) |
| Source | [`src/Storage/DebugArray.php`](https://github.com/php-forge/debug-core/blob/main/src/Storage/DebugArray.php#L13) |

Represents a PHP array with arbitrary nested values as JSON-safe debug data.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`capture()`](#method-capture) static | Captures an array as tagged debug data. | `DebugArray` |
| [`fromArray()`](#method-fromArray) static | Hydrates a tagged debug array from decoded JSON data. | `DebugArray` |
| [`jsonSerialize()`](#method-jsonSerialize) | Returns the tagged array for JSON serialization. | `DebugArray` |
| [`values()`](#method-values) | Returns captured entries as display-safe PHP values. | `DebugArray` |

## Method details

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

```php
public static function capture(array<array-key, mixed> $value): self
```

Captures an array as tagged debug data.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `array<array-key, mixed>` | PHP values to capture. |

**Returns**

`self`: Tagged array facade.

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

```php
public static function fromArray(mixed $value, string $path): self
```

Hydrates a tagged debug array from decoded JSON data.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `mixed` | Decoded tagged value. |
| `$path` | `string` | Payload path used in hydration errors. |

**Returns**

`self`: Hydrated array facade.

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

```php
public function jsonSerialize(): array<string, mixed>
```

Returns the tagged array for JSON serialization.

**Returns**

`array<string, mixed>`: Tagged array payload.

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

```php
public function values(): array<array-key, mixed>
```

Returns captured entries as display-safe PHP values.

**Returns**

`array<array-key, mixed>`: Display-safe PHP values.