ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

PHP CBF

by andremacola ST3

Sublime Text plugin for PHP_CodeSniffer

Labels php, phpcs, formatting

Details

Installs

  • Total 52
  • Win 39
  • Mac 7
  • Linux 6
Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17
Windows 1 3 1 1 1 1 0 1 1 0 2 1 2 0 1 2 0 2 2 3 0 0 2 1 2 1 4 0 0 1 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 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,
        "phpcs_standard": "~/my_project/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.