#!/usr/bin/env php Run this PHP script from the command line to see CLI syntax highlighting and formatting. It supports Unix pipes or command line argument style.

"; echo "
php bin/sql-formatter \"SELECT * FROM MyTable WHERE (id>5 AND \\`name\\` LIKE \\"testing\\");\"
"; echo "
echo \"SELECT * FROM MyTable WHERE (id>5 AND \\`name\\` LIKE \\"testing\\");\" | php bin/sql-formatter
"; exit; } if(isset($argv[1])) { $sql = $argv[1]; } else { $sql = stream_get_contents(fopen('php://stdin', 'r')); } $autoloadFiles = [ __DIR__ . '/../vendor/autoload.php', __DIR__ . '/../../../autoload.php' ]; foreach ($autoloadFiles as $autoloadFile) { if (file_exists($autoloadFile)) { require_once $autoloadFile; break; } } echo (new \Doctrine\SqlFormatter\SqlFormatter())->format($sql);