phpfmt support for Sublime Text 2/3
This project follows a Code of Conduct.
- You must have a running copy of PHP on the machine you are running Sublime Text
Plugin runs with PHP 7.0 or newer installed in the machine running the plugin.
- In Sublime Text press
ctrl+shift+P
- Choose
Package Control: Install Package
- Choose
phpfmt
- Edit configuration file (
%AppData%\Sublime Text\Packages\phpfmt\phpfmt.sublime-settings
) - For field
"php_bin"
enter the path to the php.exe Example:"php_bin":"c:/PHP/php.exe"
- Edit configuration file (
phpfmt.sublime-settings
) - For field
"php_bin"
enter the path to the php Example:"php_bin":"/usr/local/bin/php"
Prefer using the toggle options at command palette. However you might find yourself in need to setup where PHP is running, use this option below for the configuration file.
{
"php_bin":"/usr/local/bin/php",
}
The following features are available through command palette (ctrl+shift+P
or cmd+shift+P
) :
%CMD%
%PASSES%
Before | After |
|
|
|
|
|
note how it sorts the use clauses, and removes unused ones |
Before | After |
|
|
|
|
|
note how it sorts the use clauses, and removes unused ones |
- Be sure you can run PHP from the command line.
- If you need support, please open an issue at fmt issues
I want to use sublime-phpfmt, but it needs PHP 5.6 or newer and on my production server I have PHP 5.5 or older. What should I do?
Consider installing a standalone PHP 5.6 in a separate directory and have it not
configured in the environment. Within the plugin, ensure php_bin
parameter is pointed to this standalone installation.
- GoSublime - for the method to update the formatted buffer
- Google's diff match patch - http://code.google.com/p/google-diff-match-patch/