Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Laravel DB SQL HighlightingNew to Visual Studio Code? Get it now.
Laravel DB SQL Highlighting

Laravel DB SQL Highlighting

ashpowell

|
4 installs
| (0) | Free
Adds SQL syntax highlighting to raw SQL strings passed to Laravel's DB facade and query builder.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Laravel DB SQL Highlighting

Adds SQL syntax highlighting to raw SQL strings passed directly to Laravel's DB facade or query builder in PHP files.

The extension is declarative: it injects VS Code's built-in SQL TextMate grammar into recognised PHP strings and gives the query the same source.sql scope as a standalone SQL document. This allows colour themes to apply their SQL-specific rules and does not require any extension code to run.

Supported calls

  • DB::select()
  • DB::selectOne()
  • DB::selectResultSets()
  • DB::scalar()
  • DB::insert()
  • DB::update()
  • DB::delete()
  • DB::statement()
  • DB::affectingStatement()
  • DB::unprepared()
  • DB::raw()
  • $query->selectRaw()

Leading namespace paths are supported, including \DB and \Illuminate\Support\Facades\DB.

The selectRaw() query-builder method is supported on Eloquent and database query chains, including Model::query()->selectRaw().

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.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft