SqlFormatter is not a must-have tool for Web developers, but using it you'll make your life easier as a programmer.
This PHP class will take a convoluted SQL query and break it apart into its smaller bits, properly indenting it and the optionally using a syntax highlighting scheme so the important sections pop out and are read easier.
The syntax highlighting and code formatting functions are separated in the class' source, meaning developers can use them independently from the other.
Besides this, SqlFormatter can also remove any comments from the SQL code, split SQL strings into queries, and also comes with support for regular expressions.
Demos and usage instructions are included with the download package.
What is new in this release:
- Added proper formatting for square bracket quoted strings (SQL Server style).
What is new in version 1.2.17:
- Fixed PHP notice for queries that start with a boundary character. This was caused by a missing isset check.
What is new in version 1.2.16:
- Added SqlFormatter::compress method for formatting queries on a single line. Useful for copy/pasting into the command line
- Improved reserved word detection. For example, count is only a reserved word when followed by parentheses now
- More reserved words recognized
- Highlighting support for SQL variables and binary/hex numbers
- Better formatting of LIMIT clauses
- Increased PHPUnit code coverage
- Performance improvements
- Better negative number formatting
Requirements:
- PHP 5.2.4 or higher
Comments not found