PHP code example of coffreo / php-cs-fixer-config

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

    

coffreo / php-cs-fixer-config example snippets




use Coffreo\PhpCsFixer\Config;

// read composer
$composer = json_decode(file_get_contents(__DIR__."/composer.json"));
if (null === $composer) {
    throw new \Exception('Composer.json invalid. CS-Fixer aborted.');
}
$header = Config\HeaderHelper::coffreo(compact("composer"));

$config = Config\Factory::fromRuleSet(

    // CHOOSE YOUR RULE SET HERE
    new Config\RuleSet\Php54($header)

);
$config->getFinder()->in(__DIR__.'/src');
$config->setCacheFile(__DIR__.'/.php_cs.cache');

return $config;

vendor/
.php_cs.cache