# UserSnapshot

> Canonical User panel identity and RBAC snapshot.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Panel](/docs/extensions/debug-core/reference/panel/index.md) › [User](/docs/extensions/debug-core/reference/panel/user/index.md) › UserSnapshot

| final readonly class | `PHPForge\Debug\Panel\User\UserSnapshot` |
| --- | --- |
| Implements | [`PHPForge\Debug\Storage\PanelSnapshot`](/docs/extensions/debug-core/reference/storage/panelsnapshot/index.md) |
| Uses traits | [`PHPForge\Debug\Storage\ArrayPayloadSnapshot`](/docs/extensions/debug-core/reference/storage/arraypayloadsnapshot/index.md) |
| Source | [`src/Panel/User/UserSnapshot.php`](https://github.com/php-forge/debug-core/blob/main/src/Panel/User/UserSnapshot.php#L12) |

Canonical User panel identity and RBAC snapshot.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| <span id="method-__construct"></span>[`__construct()`](/docs/extensions/debug-core/reference/storage/arraypayloadsnapshot/index.md#method-__construct) final | Creates a snapshot from a tagged dynamic payload. | [`PHPForge\Debug\Storage\ArrayPayloadSnapshot`](/docs/extensions/debug-core/reference/storage/arraypayloadsnapshot/index.md) |
| <span id="method-capture"></span>[`capture()`](/docs/extensions/debug-core/reference/storage/arraypayloadsnapshot/index.md#method-capture) static | Captures arbitrary array values in a JSON-safe snapshot. | [`PHPForge\Debug\Storage\ArrayPayloadSnapshot`](/docs/extensions/debug-core/reference/storage/arraypayloadsnapshot/index.md) |
| [`data()`](#method-data) | Returns the captured identity and RBAC payload. | `UserSnapshot` |
| <span id="method-fromArray"></span>[`fromArray()`](/docs/extensions/debug-core/reference/storage/arraypayloadsnapshot/index.md#method-fromArray) static | Hydrates a dynamic payload from decoded JSON data. | [`PHPForge\Debug\Storage\ArrayPayloadSnapshot`](/docs/extensions/debug-core/reference/storage/arraypayloadsnapshot/index.md) |
| <span id="method-jsonSerialize"></span>[`jsonSerialize()`](/docs/extensions/debug-core/reference/storage/arraypayloadsnapshot/index.md#method-jsonSerialize) | Returns the tagged payload for JSON serialization. | [`PHPForge\Debug\Storage\ArrayPayloadSnapshot`](/docs/extensions/debug-core/reference/storage/arraypayloadsnapshot/index.md) |
| [`payloadKey()`](#method-payloadKey) protected static | Returns the key under which the user payload is stored. | `UserSnapshot` |

## Method details

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

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

Returns the captured identity and RBAC payload.

**Returns**

`array<array-key, mixed>`: Captured identity attributes, roles, and permissions.

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

```php
protected static function payloadKey(): string
```

Returns the key under which the user payload is stored.

**Returns**

`string`: Payload key.