PHP code example of php-collective / code-sniffer

1. Go to this page and download the library: Download php-collective/code-sniffer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

php-collective / code-sniffer example snippets


vendor/php-collective/code-sniffer/                          # Base directory
                           |_ PhpCollective/                # Rule set name
                                      |_ ruleset.xml  # Rule set

vendor/bin/phpcs --config-set installed_paths vendor/php-collective/code-sniffer/
vendor/bin/phpcs --config-set default_standard PhpCollective
xml
<rule ref="vendor/php-collective/code-sniffer/PhpCollective/ruleset.xml"/>
xml
<rule ref="vendor/php-collective/code-sniffer/PhpCollectiveStrict/ruleset.xml"/>