PHP CBF
Sublime Text plugin for PHP CodeSniffer ( phpcbf )
Details
Installs
- Total 1K
- Win 813
- Mac 268
- Linux 318
Dec 21 | Dec 20 | Dec 19 | Dec 18 | Dec 17 | Dec 16 | Dec 15 | Dec 14 | Dec 13 | Dec 12 | Dec 11 | Dec 10 | Dec 9 | Dec 8 | Dec 7 | Dec 6 | Dec 5 | Dec 4 | Dec 3 | Dec 2 | Dec 1 | Nov 30 | Nov 29 | Nov 28 | Nov 27 | Nov 26 | Nov 25 | Nov 24 | Nov 23 | Nov 22 | Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 |
Linux | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
PHP_CBF for Sublime Text ¾
This is a lightweight ST Package to fix your php files with PHP Codebeautifier aka phpcbf
. It is based on the original PHP_CodeSniffer package without the phpcs
.
The advantage of this plugin is that it acts directly in the Sublime Text buffer, avoiding file reloading thus being faster.
For linting your code, please use Sublimelinter-phpcs. It is a more modern package for the purpose.
Installation
Package Control
This package is available through Package Control.
Package Control ‣ Install Package ‣ PHP CBF
Cloning the repository
- Clone the PHP_CBF Sublime Text Plugin in to ST3/ST4 Packages directory.
git clone https://github.com/andremacola/PHP_CBF PHP_CBF
- Packages directory locations:
Mac: /Users/{user}/Library/Application Support/Sublime Text 3/Packages
Windows: C:\Users\{user}\AppData\Roaming\Sublime Text 3\Packages
Linux: ~/.config/sublime-text-3/Packages
Configuration
Configuration files can be opened via Preferences > Package Settings > PHP_CBF.
Make sure the php_path and phpcbf_path paths are correct. E.g.
"phpcs_path": "/usr/local/bin/phpcs",
"phpcbf_path": "/usr/local/bin/phpcbf",
phpcs_standard
This settings can be the name of a single standard or a list of folder/project names and the standard to be used for each project. E.g.
"phpcs_standard": "Squiz"
// sublime-project
"settings": {
"PHP_CBF": {
"fix_on_save": true,
"phpcbf_path": "${folder}/vendor/bin/phpcbf",
"phpcs_standard": "${folder}/phpcs.xml"
}
}
additional_args
Array containing additional arguments to pass to the PHPCS/PHPCBF scripts.
fix_on_save
If set to true then buffer will be checked and fixed on each save.
Usage
There are one shortcut that can be used for Sublime PHP_CBF plugin: - ALT + SHIFT + S: Runs PHPCBF command for the open buffer.
These commands are also available in Tools > PHP_CBF menu.
Known Issues
If your project is configured to work with tabs
, but for some reason ST is configured to indent with spaces
(see conf in the bottom right corner), PHPCBF maybe start a loop saving process if fix_on_save
is enabled.