File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,29 @@ docker run --pull always \
64
64
And the server will show only 3 levels of nested objects in the preview, but you can still see the full dump by opening
65
65
the event page.
66
66
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
+
67
90
## Trap
68
91
69
92
Please consider to use [ Buggregator Trap] ( ../trap/what-is-trap.md ) to dump variables in your application. It uses
You can’t perform that action at this time.
0 commit comments