To install in your project, use:
composer require fws/php-coding-standards --dev
Then add a phpcs.xml
file to your project:
<?xml version="1.0"?>
<ruleset name="Project">
<rule ref="FWS"/>
</ruleset>
To do this quickly, run:
echo '<?xml version="1.0"?><ruleset name="Project"><rule ref="FWS"/></ruleset>' > phpcs.xml
Installation will automatically install Forwardslash
standard for vendor/bin/phpcs
.
./vendor/bin/phpcs -s path/to/file.php
./vendor/bin/phpcs -s --extensions=php /path/to/dir
In your favorite editor install it's phpcs
plugin, and it will automatically detect your phpcs.xml
file and lint any PHP file you have open.