It was asked some time ago, but anyway, there is a good package, for many languages, here: https://sublime.wbond.net/packages/CodeFormatter
Answer from Surt on Stack OverflowVideos
- CodeFormatter: (abandoned, throws errors)
- JSPrettier - doesn't support php
- Others I've tried just either don't work or can't find them in package control?
Do any of you have a php code beautifier plugin that works? Preferably an option to beautify on save. Thank you!
PHPTidy is definitely good choice for PHP code formatting in SublimeText2.
You need to install package control package to enable you to install packaged in sublime text: link.
ctrl+shift+p -> type -> Package Control: Install Package
search for phpTidy -> hit enter
that is it - now you can format your code in WordPress coding convention.
How to format you code:
- ctrl+shift+p -> type -> tidy -> Hit Enter
- ctrl+alt+t
Hope this help.
There is a PHP code formatter named PhpBeautifier. Here you can find a Sublime Text plugin for this program and you can also install it via package control.