# ConnectionInstrumentation

> Attaches the debugger to the application database connection at bootstrap.

[API reference](/docs/api/index.md) › [Yii3 Debug](/docs/extensions/yii3-debug/reference/index.md) › [Db](/docs/extensions/yii3-debug/reference/db/index.md) › ConnectionInstrumentation

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

Attaches the debugger to the application database connection at bootstrap.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`apply()`](#method-apply) static | Attaches available observers to the application connection. | `ConnectionInstrumentation` |

## Method details

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

```php
public static function apply(Psr\Container\ContainerInterface $container): void
```

Attaches available observers to the application connection.

Logger attachment applies to logger-aware connections. Profiler instrumentation applies independently to
PDO-backed, profiler-aware connections. Missing services or unsupported capabilities leave that operation
untouched. Attaching is idempotent, so application wiring remains valid.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$container` | `Psr\Container\ContainerInterface` | Container the connection and its observers are resolved from. |