php:phpcsfixer
This is an old revision of the document!
Table of Contents
PHP CS Fixer
The PHP Coding Standards Fixer (PHP CS Fixer) tool fixes your code to follow standards; whether you want to follow PHP coding standards as defined in the PSR-1, PSR-2, etc., or other community driven ones like the Symfony one. You can also define your (team's) style through configuration.
https://github.com/FriendsOfPHP/PHP-CS-Fixer
Install (global):
wget https://cs.symfony.com/download/php-cs-fixer-v2.phar -O php-cs-fixer sudo chmod a+x php-cs-fixer sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer
update (global):
sudo php-cs-fixer self-update
Usage in dry run mode:
php-cs-fixer fix /path/to/code --dry-run
Sublime Text Plugin
Installing Package Control
- The simplest method of installing the Package Control plugin is through Sublime Text itself.
- Open Sublime Text and open the Command Palette… by selecting Command Palette from the Tools pull-down menu.
- In the menu that opens type install which will result in the Install Package Control option being presented.
- Hit Enter or left click the entry to install Package Control.
Installing Packages
- Open the Command Palette… by selecting Command Palette from the Tools pull-down menu.
- In the popup window that appears type Install to search for the install option through Package Control.
- When Package Control: Install Package is highlighted press Return.
- You can use the arrow keys to move the selected option.
Plugin name: “PHP CS Fixer”
Config info:
https://github.com/adael/SublimePhpCsFixer
VSCode plugins
php/phpcsfixer.1682775294.txt.gz · Last modified: 2023/05/29 11:53 (external edit)