WebDevStudios PHP Coding Standards
Install
To install in your project, use:
composer require webdevstudios/php-coding-standards:~1.3.0 --dev
Then add a .phpcs.xml.dist
file to your project:
<?xml version="1.0"?>
<ruleset name="Project">
<rule ref="WebDevStudios"/>
</ruleset>
To do this quickly, run:
echo '<?xml version="1.0"?><ruleset name="Project"><rule ref="WebDevStudios"/></ruleset>' > .phpcs.xml.dist
Installation will automatically install WebDevStudios
standard for vendor/bin/phpcs
.
CLI Linting
Lint a single file
./vendor/bin/phpcs -s path/to/file.php
Lint multiple files
./vendor/bin/phpcs -s --extensions=php /path/to/dir
Editor Linting
In your favorite editor install it's phpcs
package and it will automatically detect your phpcs.xml.dist
file and lint any PHP file you have open. You may need to re-configure your settings if you are moving from WDS-Coding-Standards.