SqlHighlighter
API reference › Debug Core › Panel › Db › SqlHighlighter
Recognizes SQL statements and highlights them as escape-safe HTML for the DB, Log, and Profiling panels.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
highlight() static | Returns the SQL statement as fully escaped HTML with yii-debug-sql-* token spans. | SqlHighlighter |
isStatement() static | Returns whether the value reads as a raw SQL statement rather than as a log or profiling sentence. | SqlHighlighter |
Method details
Section titled “Method details”highlight()
Section titled “highlight() ”public static function highlight(string $sql): stringReturns the SQL statement as fully escaped HTML with yii-debug-sql-* token spans.
Parameters
| Parameter | Type | Description |
|---|---|---|
$sql | string | Raw SQL statement to highlight. |
Returns
string: Escaped HTML with yii-debug-sql-* token spans.
isStatement()
Section titled “isStatement() ”public static function isStatement(string $value): boolReturns whether the value reads as a raw SQL statement rather than as a log or profiling sentence.
Panels whose rows mix both call this to decide when highlight() applies, so statements logged under a
category the panel does not know still render with the token spans of the queries grid.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string | Message or block description to inspect. |
Returns
bool: true when the value opens a SQL statement; false otherwise.