<?php
use Doctrine\SqlFormatter\SqlFormatter;
$sql = 'select id, name, feathers, color from budgy where dirt_level > 50';
$sql .= ' group by flock order by cage_id';
echo (new SqlFormatter())->format($sql);
select id, name, feathers, color from budgy where dirt_level > 50 group by flock order by cage_id