Sun* coding standard for PHP_CodeSniffer.
Using composer
composer require --dev sun-asterisk/coding-standard
Add the SunAsterisk
standard to your project's phpcs.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="YourProject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<rule ref="SunAsterisk"/>
</ruleset>
Or use it on the command line
vendor/bin/phpcs --standard=SunAsterisk <file or directory to check>
The SunAsteriskLaravel
standard is extended for Laravel projects.
You can use it as below:
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="YourProject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<file>app</file>
<file>config</file>
<file>database</file>
<file>resources</file>
<file>routes</file>
<file>tests</file>
<exclude-pattern>vendor/</exclude-pattern>
<rule ref="SunAsteriskLaravel"/>
</ruleset>
Refer to the phpcs documents for more detailed usage. Also refer to slevomat/coding-standard for details on some sniffs.