# RequestSummary

> Represents canonical metadata for one captured request and its manifest row.

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

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

Represents canonical metadata for one captured request and its manifest row.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-ajax"></span>`$ajax` readonly constructor | `bool` | Whether the request used AJAX. | `RequestSummary` |
| <span id="property-excessiveCallersCount"></span>`$excessiveCallersCount` readonly constructor | `int` | Number of excessive log callers. | `RequestSummary` |
| <span id="property-ip"></span>`$ip` readonly constructor | `string` | Client IP address. | `RequestSummary` |
| <span id="property-mailCount"></span>`$mailCount` readonly constructor | `int` | Number of captured mail messages. | `RequestSummary` |
| <span id="property-mailFiles"></span>`$mailFiles` readonly constructor | `list<string>` | Captured mail file paths. | `RequestSummary` |
| <span id="property-method"></span>`$method` readonly constructor | `string` | HTTP request method. | `RequestSummary` |
| <span id="property-peakMemory"></span>`$peakMemory` readonly constructor | `int\|null` | Peak memory in bytes or `null` when unavailable. | `RequestSummary` |
| <span id="property-processingTime"></span>`$processingTime` readonly constructor | `float\|null` | Processing duration in seconds or `null` when unavailable. | `RequestSummary` |
| <span id="property-sqlCount"></span>`$sqlCount` readonly constructor | `int` | Number of SQL queries. | `RequestSummary` |
| <span id="property-statusCode"></span>`$statusCode` readonly constructor | `int` | HTTP response status code. | `RequestSummary` |
| <span id="property-tag"></span>`$tag` readonly constructor | `string` | Unique request tag. | `RequestSummary` |
| <span id="property-time"></span>`$time` readonly constructor | `float` | Request start timestamp. | `RequestSummary` |
| <span id="property-url"></span>`$url` readonly constructor | `string` | Requested URL. | `RequestSummary` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`create()`](#method-create) static | Creates an empty request summary ready for immutable enrichment. | `RequestSummary` |
| [`fromArray()`](#method-fromArray) static | Hydrates request metadata from decoded JSON data. | `RequestSummary` |
| [`jsonSerialize()`](#method-jsonSerialize) | Returns the request metadata for JSON serialization. | `RequestSummary` |
| [`withDatabase()`](#method-withDatabase) | Returns a copy with database counters. | `RequestSummary` |
| [`withMail()`](#method-withMail) | Returns a copy with captured mail metadata. | `RequestSummary` |
| [`withProfiling()`](#method-withProfiling) | Returns a copy enriched with processing time and peak memory usage. | `RequestSummary` |
| [`withRequest()`](#method-withRequest) | Returns a copy with HTTP request metadata. | `RequestSummary` |
| [`withResponse()`](#method-withResponse) | Returns a copy with the HTTP response status. | `RequestSummary` |

## Method details

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

```php
public static function create(string $tag): self
```

Creates an empty request summary ready for immutable enrichment.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$tag` | `string` |  |

**Returns**

`self`

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

```php
public static function fromArray(mixed $data, string $path = '$.summary'): self
```

Hydrates request metadata from decoded JSON data.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$data` | `mixed` | Decoded request metadata. |
| `$path` | `string` | Payload path used in hydration errors. |

**Returns**

`self`: Hydrated request metadata.

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

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

Returns the request metadata for JSON serialization.

**Returns**

`array<string, mixed>`: Serialized request metadata.

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

```php
public function withDatabase(int $sqlCount, int $excessiveCallersCount = 0): self
```

Returns a copy with database counters.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$sqlCount` | `int` |  |
| `$excessiveCallersCount` | `int` |  |

**Returns**

`self`

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

```php
public function withMail(int $mailCount, list<string> $mailFiles): self
```

Returns a copy with captured mail metadata.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$mailCount` | `int` |  |
| `$mailFiles` | `list<string>` |  |

**Returns**

`self`

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

```php
public function withProfiling(float $processingTime, int $peakMemory): self
```

Returns a copy enriched with processing time and peak memory usage.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$processingTime` | `float` | Processing duration in seconds. |
| `$peakMemory` | `int` | Peak memory in bytes. |

**Returns**

`self`: Request metadata enriched with profiling values.

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

```php
public function withRequest(string $url, string $method, string $ip, float $time, bool $ajax = false): self
```

Returns a copy with HTTP request metadata.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$url` | `string` |  |
| `$method` | `string` |  |
| `$ip` | `string` |  |
| `$time` | `float` |  |
| `$ajax` | `bool` |  |

**Returns**

`self`

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

```php
public function withResponse(int $statusCode): self
```

Returns a copy with the HTTP response status.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$statusCode` | `int` |  |

**Returns**

`self`