In Sublime Text 2, I am trying to type the code and have auto format command to rearrange and auto indent source code. If it is not possible to have a automatic formatter, would be nice to have a shortcut command to do it.
I am searching for something else besides the built-in "Reindent" option and the hard-to-make-work "PHP Beautifier" plugin.
I would like to know if someone found any nice auto formatter for PHP: any formatter that won't mess our PHP code. JSFormat seems to be not useful.
Is there any easy to "install and use" plugin?
The most significantly PHP-focused package for Sublime Text is called Sublime PHP Companion. Like most packages, it contains a series of actions you can perform.
Beautify on Save sublime-settings : Ctrl+Shift+P or Cmd+Shift+P in Linux/Windows/OS X.
Add right click menu option for Format HTML in PHP. Add keybind Ctrl + Alt + F to format HTML in a PHP file.
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.
- 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With