# ToolbarInjector

> Places rendered toolbar markup inside an already-rendered HTML response.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Toolbar](/docs/extensions/debug-core/reference/toolbar/index.md) › ToolbarInjector

| final class | `PHPForge\Debug\Toolbar\ToolbarInjector` |
| --- | --- |
| Source | [`src/Toolbar/ToolbarInjector.php`](https://github.com/php-forge/debug-core/blob/main/src/Toolbar/ToolbarInjector.php#L13) |

Places rendered toolbar markup inside an already-rendered HTML response.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`inject()`](#method-inject) static | Injects toolbar markup immediately before the final closing body tag. | `ToolbarInjector` |

## Method details

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

```php
public static function inject(string $html, string $toolbar): string
```

Injects toolbar markup immediately before the final closing body tag.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$html` | `string` | Response HTML. |
| `$toolbar` | `string` | Rendered toolbar markup. |

**Returns**

`string`: HTML containing the toolbar, appended when no closing body tag exists.