PHP code example of davahome / php-cs-fixer-ruleset

1. Go to this page and download the library: Download davahome/php-cs-fixer-ruleset 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/ */

    

davahome / php-cs-fixer-ruleset example snippets




n \DavaHome\PhpCsFixer::createFromDir(__DIR__)->getRuleSet();



use DavaHome\PhpCsFixer;
use PhpCsFixer\Finder;

Path('/^data/');
    
return (new PhpCsFixer($finder))
    ->getRuleSet()
    ->setCacheFile(__DIR__ . '/data/cache/.php_cs.cache');



use DavaHome\PhpCsFixer;
use PhpCsFixer\Finder;

Path('/exclude/');

return (new PhpCsFixer($finder))
    ->getRuleSet()
    ->setLineEnding("\r\n")
    ->setCacheFile('/tmp/.php_cs.cache')
    ->setIndent("\t")
    ->setRiskyAllowed(false)
    ->setUsingCache(true);
bash
php composer.phar 
bash
php php-cs-fixer.phar fix --config=php_cs.php
php php-cs-fixer.phar fix --dry-run --diff --config=php_cs.php
json
{
    "scripts": {
        "phpcs": [
            "bash bin/php-cs-fixer.sh",
            "php php-cs-fixer.phar fix --config=php_cs.php"
        ]
    }
}