Skip to content
PHP Ecosystem
Explore

SqlHighlighter

API reference › Debug Core › Panel › Db › SqlHighlighter

final classPHPForge\Debug\Panel\Db\SqlHighlighter
Sourcesrc/Panel/Db/SqlHighlighter.php

Recognizes SQL statements and highlights them as escape-safe HTML for the DB, Log, and Profiling panels.

MethodDescriptionDefined by
highlight() staticReturns the SQL statement as fully escaped HTML with yii-debug-sql-* token spans.SqlHighlighter
isStatement() staticReturns whether the value reads as a raw SQL statement rather than as a log or profiling sentence.SqlHighlighter
public static function highlight(string $sql): string

Returns the SQL statement as fully escaped HTML with yii-debug-sql-* token spans.

Parameters

ParameterTypeDescription
$sqlstringRaw SQL statement to highlight.

Returns

string: Escaped HTML with yii-debug-sql-* token spans.

public static function isStatement(string $value): bool

Returns 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

ParameterTypeDescription
$valuestringMessage or block description to inspect.

Returns

bool: true when the value opens a SQL statement; false otherwise.