# doctrine/sql-formatter

A lightweight php class for formatting sql statements. Handles automatic indentation and syntax highlighting.

Repository: https://github.com/doctrine/sql-formatter
Canonical: https://ross.abutalabs.com/products/doctrine-sql-formatter
Language: HTML
License: MIT
License Family: permissive
Last push: 2026-06-11T14:32:46+00:00

## Health v2 (maintenance only)
Score: 75/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 87, release rhythm 45, longevity 100
- inputs: {"age_days": 2355, "days_push": 83, "days_rel": 206, "gap_med": 99.5, "n_releases_24m": 5}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1865, forks 29 (observed 2026-08-28T04:05:46.226281+00:00)

## What it is
A lightweight PHP library for formatting SQL statements with automatic indentation, line breaks, and syntax highlighting. It is a maintained fork of jdorn/sql-formatter under the Doctrine organization.

## Use cases
- format sql queries for debugging
- pretty print sql statements
- add syntax highlighting to sql output
- compress sql queries by removing comments and whitespace
- format sql for error logs

## When to choose
- you need to pretty-print or highlight SQL in a PHP application
- you want a small dependency-free formatter for debugging auto-generated queries
- you need SQL output suitable for logs or the command line

## When to avoid
- you need to parse or analyze SQL semantically rather than format it
- you need SQL linting or validation
- you work outside PHP

## Facets
- artifact type: library
- maturity: stable
- function: formatter, parser
- domain: databases, developer-tools, web-development
- platform: php, cli
- tags: sql, syntax-highlighting, pretty-printing, debugging

## Member repositories
- doctrine/sql-formatter (main) score 75

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:46.226281+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:15:33.728144+00:00, confidence not recorded.
  - readme: https://github.com/doctrine/sql-formatter (fetched 2026-08-28T04:05:46.226281+00:00, sha 2dfc06cb3041)
- Data as of 2026-08-30T08:39:29.467469+00:00.
