PHP-Styler is a companion to PHP-Parser for reconstructing PHP code after it has been deconstructed into an abstract syntax tree. (You can find the code for this demo site on Github.)
Try out PHP-Styler for yourself! Paste in your code, and in a moment PHP-Styler will reformat it below.
<?php