# HistoryComparison

> Builds a privacy-preserving comparison of two immutable debugger snapshots.

[API reference](/docs/api/index.md) › [Yii3 Debug](/docs/extensions/yii3-debug/reference/index.md) › [Comparison](/docs/extensions/yii3-debug/reference/comparison/index.md) › HistoryComparison

| final readonly class | `Yii3\Debug\Comparison\HistoryComparison` |
| --- | --- |
| Source | [`src/Comparison/HistoryComparison.php`](https://github.com/yii3/debug/blob/main/src/Comparison/HistoryComparison.php#L18) |

Builds a privacy-preserving comparison of two immutable debugger snapshots.

Summary metrics expose already-redacted manifest data. Panel payloads are compared structurally, retaining only
counts of added, removed, changed, and unchanged JSON leaves instead of copying their values into the overview.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-baseline"></span>`$baseline` readonly | `PHPForge\Debug\Storage\DebugSnapshot` | Baseline snapshot. | `HistoryComparison` |
| <span id="property-metrics"></span>`$metrics` readonly constructor | `list<`[`HistoryMetricComparison`](/docs/extensions/yii3-debug/reference/comparison/historymetriccomparison/index.md)`>` | Request-summary metric comparisons. | `HistoryComparison` |
| <span id="property-panels"></span>`$panels` readonly constructor | `list<`[`HistoryPanelComparison`](/docs/extensions/yii3-debug/reference/comparison/historypanelcomparison/index.md)`>` | Per-panel structural comparisons. | `HistoryComparison` |
| <span id="property-target"></span>`$target` readonly | `PHPForge\Debug\Storage\DebugSnapshot` | Target snapshot. | `HistoryComparison` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`fromSnapshots()`](#method-fromSnapshots) static | Creates a comparison from two snapshots. | `HistoryComparison` |
| [`hasDifferences()`](#method-hasDifferences) | Returns whether either summary metrics or panel payloads differ. | `HistoryComparison` |

## Method details

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

```php
public static function fromSnapshots(PHPForge\Debug\Storage\DebugSnapshot $baseline, PHPForge\Debug\Storage\DebugSnapshot $target, array<string, string> $panelLabels = []): self
```

Creates a comparison from two snapshots.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$baseline` | `PHPForge\Debug\Storage\DebugSnapshot` | Capture used as the reference side of the comparison. |
| `$target` | `PHPForge\Debug\Storage\DebugSnapshot` | Capture compared against the baseline. |
| `$panelLabels` | `array<string, string>` | Display names indexed by stable panel ID. |

**Returns**

`self`: Comparison holding the metric and panel differences between both captures.

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

```php
public function hasDifferences(): bool
```

Returns whether either summary metrics or panel payloads differ.

**Returns**

`bool`: `true` when metrics or panel payloads differ; `false` when the captures match.