Skip to content

Commit c514817

Browse files
committed
Adds information about syntax highlighting
1 parent ed4163f commit c514817

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/config/var-dumper.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,29 @@ docker run --pull always \
6464
And the server will show only 3 levels of nested objects in the preview, but you can still see the full dump by opening
6565
the event page.
6666

67+
## Syntax Highlighting
68+
69+
When you dump a variable that contains only text, you can enable syntax highlighting for it. The easiest way to do this
70+
is to use the `trap` function from the [Buggregator Trap](../trap/what-is-trap.md) package.
71+
72+
All you need to do is install the package and use the `trap` function with context:
73+
74+
```php
75+
$code = <<<PHP
76+
<?php
77+
78+
declare(strict_types=1);
79+
80+
echo 'Hello, World!';
81+
PHP;
82+
83+
trap($code)->context(language: 'php');
84+
```
85+
86+
And the output will be highlighted as PHP code.
87+
88+
![image_2024-05-01_00-39-56](https://github.com/buggregator/frontend/assets/773481/9cddfbfa-e3a3-427e-a987-0f4aa1bdb504)
89+
6790
## Trap
6891

6992
Please consider to use [Buggregator Trap](../trap/what-is-trap.md) to dump variables in your application. It uses

0 commit comments

Comments
 (0)