# DumpCollector

> Captures trace-level log messages emitted by Yii::debug() for the Dump panel.

[API reference](/docs/api/index.md) › [Debug](/docs/extensions/debug/reference/index.md) › [collectors](/docs/extensions/debug/reference/collectors/index.md) › DumpCollector

| class | `yii\debug\collectors\DumpCollector` |
| --- | --- |
| Extends | [`Collector`](/docs/extensions/debug/reference/collectors/collector/index.md) |
| Implements | [`CollectorInterface`](https://github.com/php-forge/debug/blob/e4fbb8c3238a4d011ceef5e0094344abd50deaf4/src/CollectorInterface.php) |
| Source | [`src/collectors/DumpCollector.php`](https://github.com/yii2-extensions/debug/blob/main/src/collectors/DumpCollector.php#L16) |

Captures trace-level log messages emitted by `Yii::debug()` for the Dump panel.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-categories"></span>`$categories` | `list<string>` | Message categories to capture; an empty list captures every category. Default: `['application']`. | `DumpCollector` |
| <span id="property-depth"></span>`$depth` | `int` | Maximum recursion depth applied by the dumper. Default: `10`. | `DumpCollector` |
| <span id="property-highlight"></span>`$highlight` | `bool` | Whether the rendered dump should be syntax-highlighted. Default: `true`. | `DumpCollector` |
| <span id="property-module"></span>[`$module`](/docs/extensions/debug/reference/collectors/collector/index.md#property-module) | [`yii\debug\Module`](/docs/extensions/debug/reference/module/index.md)`\|null` | Debug module supplying the log target and sibling collectors, assigned by the module on registration. Default: `null`. | [`Collector`](/docs/extensions/debug/reference/collectors/collector/index.md) |
| <span id="property-varDumpCallback"></span>`$varDumpCallback` | [`Closure`](https://www.php.net/manual/en/class.closure.php)`(mixed, self): string\|null` | Callback that replaces the built-in [`VarDumper`](/docs/api/yii/helpers/vardumper/index.md) rendering when set. Default: `null`. | `DumpCollector` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| <span id="method-capture"></span>[`capture()`](/docs/extensions/debug/reference/collectors/collector/index.md#method-capture) final | Encodes the typed snapshot built by the subclass into the payload persisted for the panel. | [`Collector`](/docs/extensions/debug/reference/collectors/collector/index.md) |
| [`id()`](#method-id) | Returns the stable ID pairing this collector with the Dump panel. | `DumpCollector` |
| <span id="method-instrument"></span>[`instrument()`](/docs/extensions/debug/reference/collectors/collector/index.md#method-instrument) | Installs low-level instrumentation as soon as the module registers the collector, before the panels are built. | [`Collector`](/docs/extensions/debug/reference/collectors/collector/index.md) |
| <span id="method-shutdown"></span>[`shutdown()`](/docs/extensions/debug/reference/collectors/collector/index.md#method-shutdown) final | Deactivates the collector once, releasing any subscription created by [`start()`](/docs/extensions/debug/reference/collectors/collector/index.md#method-start). | [`Collector`](/docs/extensions/debug/reference/collectors/collector/index.md) |
| <span id="method-startup"></span>[`startup()`](/docs/extensions/debug/reference/collectors/collector/index.md#method-startup) final | Activates the collector once at the start of the request lifecycle. | [`Collector`](/docs/extensions/debug/reference/collectors/collector/index.md) |
| [`varDump()`](#method-varDump) | Renders a captured value as a display string. | `DumpCollector` |
| <span id="method-getLogMessages"></span>[`getLogMessages()`](/docs/extensions/debug/reference/collectors/collector/index.md#method-getLogMessages) protected | Returns the accumulated log messages, optionally filtered by level, category, and exclusion lists. | [`Collector`](/docs/extensions/debug/reference/collectors/collector/index.md) |
| <span id="method-getLogTarget"></span>[`getLogTarget()`](/docs/extensions/debug/reference/collectors/collector/index.md#method-getLogTarget) protected | Returns the initialized log target of the owning debug module. | [`Collector`](/docs/extensions/debug/reference/collectors/collector/index.md) |
| <span id="method-isStarted"></span>[`isStarted()`](/docs/extensions/debug/reference/collectors/collector/index.md#method-isStarted) protected | Returns whether the collector is active for the current request. | [`Collector`](/docs/extensions/debug/reference/collectors/collector/index.md) |
| [`snapshot()`](#method-snapshot) protected | Captures the trace-level messages allowed by [`$categories`](/docs/extensions/debug/reference/collectors/dumpcollector/index.md#property-categories), excluding the categories owned by the Router collector, and pre-renders each captured value through [`varDump()`](/docs/extensions/debug/reference/collectors/dumpcollector/index.md#method-varDump). | `DumpCollector` |
| <span id="method-start"></span>[`start()`](/docs/extensions/debug/reference/collectors/collector/index.md#method-start) protected | Hook invoked once when the collector activates; subclasses subscribe to framework events here. | [`Collector`](/docs/extensions/debug/reference/collectors/collector/index.md) |
| <span id="method-stop"></span>[`stop()`](/docs/extensions/debug/reference/collectors/collector/index.md#method-stop) protected | Hook invoked once when the collector deactivates; subclasses detach subscriptions and clear state here. | [`Collector`](/docs/extensions/debug/reference/collectors/collector/index.md) |

## Method details

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

```php
public function id(): string
```

Returns the stable ID pairing this collector with the Dump panel.

**Returns**

`string`: Stable collector ID.

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

```php
public function varDump(mixed $var): string
```

Renders a captured value as a display string.

The built-in highlighter emits safe markup, so highlighted output is passed through unchanged. Plain output
and custom callback output are HTML-escaped explicitly.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$var` | `mixed` | Value passed to `Yii::debug()`. |

**Returns**

`string`: Display string safe to embed in the dump card.

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

```php
protected function snapshot(): PHPForge\Debug\Panel\Dump\DumpSnapshot|null
```

Captures the trace-level messages allowed by [`$categories`](/docs/extensions/debug/reference/collectors/dumpcollector/index.md#property-categories), excluding the categories owned by the Router
collector, and pre-renders each captured value through [`varDump()`](/docs/extensions/debug/reference/collectors/dumpcollector/index.md#method-varDump).

**Returns**

`PHPForge\Debug\Panel\Dump\DumpSnapshot|null`: Captured dump payload; `null` when the collector never started.