Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>PHP Inline SQL FormatterNew to Visual Studio Code? Get it now.
PHP Inline SQL Formatter

PHP Inline SQL Formatter

Vivek Makwana

|
56 installs
| (0) | Free
Format inline SQL queries in PHP files.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SQL Formatter for PHP

A lightweight Visual Studio Code extension that formats SQL queries inside PHP string assignments.

Perfect for PHP developers who write long SQL queries and want clean formatting.


✨ Features

  • ✅ Format SQL assigned to PHP variables like $sql = "..." or $query = '...'
  • ✅ Supports multi-line SQL strings
  • ✅ Respects your editor's indentation settings (tabs or spaces)
  • ✅ Automatically preserves curly-brace variables like {$table_name}
  • ✅ Safe and smart re-indentation after formatting

📸 Demo

Coming soon!


🚀 How to Use

  1. Select the line (or lines) containing your SQL string inside PHP code:
$select = "SELECT id, name FROM users WHERE active = 1 ORDER BY id DESC";

After

$select = "
  SELECT 
    id, name 
  FROM 
    users 
  WHERE 
    active = 1
  ORDER BY 
    id DESC
";

Commands to build

npm run compile
vsce package
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft