This is a plugin for Sublime Text 3 that gives the option to run the phpcbf
You need the PHP Codesniffer more precise the code beautifier from them.
Clone this repo into your Packages folder of Sublime Text. If phpcbf
is in your path you don't need to do much setup. Otherwise create a user config for this plugin and set the path to your executable.
{
"path": "/path/to/your/phpcbf"
}
Please note that the executable has to be in the string.
The usage is pretty straight forward just press CTRL+ALT+F
or use the button in the Tools menu to execute it. For longer files give it a bit to run.
Nearly all configuration options from phpcbf are bound to options in the settings file. Please refer to the documentiation for phpcbf to know what they do.
The three most important ones are
- path - Sets the path to the phpcbf executable
- level - Sets the code standard to follow. Default: psr-2
- patch - Sets whenether patch command should be used.