The simplest solution is to just use an IDE that has this built in. If you're going to be writing code in PHP on a regular a regular basis, just drop the $60 for PHPStorm. You won't regret it.
http://www.jetbrains.com/phpstorm/
It lets you format your code however you like using a simple keyboard shortcut at the file or directory level, and has a zillion other great features.