# jdorn/sql-formatter

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

Repository: https://github.com/jdorn/sql-formatter
Canonical: https://ross.abutalabs.com/products/sql-formatter
Homepage: http://jdorn.github.com/sql-formatter/
Language: HTML
License: MIT
License Family: permissive
Last push: 2023-05-26T00:23:48+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 5238, "days_push": 1196, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3846, forks 184 (observed 2026-08-28T04:08:24.157101+00:00)

## What it is
A lightweight PHP class that formats SQL statements with automatic indentation, line breaks, and HTML syntax highlighting. It also provides methods to compress queries and strip comments.

## Use cases
- format sql queries for debugging
- pretty print sql statements in php
- add syntax highlighting to sql output
- compress sql queries for the command line
- remove comments from sql strings
- log readable sql queries

## When to choose
- you need a small, dependency-free PHP library to format or highlight SQL
- you want to display auto-generated SQL in HTML for debugging
- you need to minify or strip comments from SQL queries

## When to avoid
- you need SQL parsing, validation, or execution rather than formatting
- you are not working in PHP
- you need an actively developed formatter with support for many SQL dialects

## Facets
- artifact type: library
- maturity: maintenance
- function: formatter, developer-tools
- domain: databases, developer-tools
- platform: php
- tags: sql, syntax-highlighting, pretty-printing

## Member repositories
- jdorn/sql-formatter (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:24.157101+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-29T18:26:00.872041+00:00, confidence not recorded.
  - readme: https://github.com/jdorn/sql-formatter (fetched 2026-08-28T04:08:24.157101+00:00, sha 9265e62d3785)
- Data as of 2026-08-30T08:39:29.467469+00:00.
