Adds SQL syntax highlighting to raw SQL strings passed directly to Laravel's
DB facade in PHP files.
The extension is declarative: it injects VS Code's built-in SQL TextMate grammar into recognised PHP strings and does not run any extension code.
Supported calls
DB::select()DB::selectOne()DB::selectResultSets()DB::scalar()DB::insert()DB::update()DB::delete()DB::statement()DB::affectingStatement()DB::unprepared()DB::raw()
Leading namespace paths are supported, including \DB and
\Illuminate\Support\Facades\DB.
Single-quoted PHP strings are also supported. PHP variables in double-quoted queries retain PHP variable highlighting.
Scope
The SQL must be a quoted string passed directly to a supported method. A lexical grammar cannot follow variables, so this form is not highlighted:
$query = 'SELECT * FROM users';
$rows = DB::select($query);
Concatenated expressions outside the initial SQL string continue to use normal PHP highlighting.