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

1. Go to this page and download the library: Download cartalyst/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/ */

    

cartalyst / php-cs-fixer-config example snippets




// Create a new CS Fixer Finder instance
$finder = PhpCsFixer\Finder::create()->in(__DIR__);

return Cartalyst\PhpCsFixer\Config::create()
    ->setFinder($finder)
;



// Directories to not scan
$excludeDirs = [
    'vendor/',
];

// Files to not scan
$excludeFiles = [
    'config/app.php',
];

// Create a new CS Fixer Finder instance
$finder = PhpCsFixer\Finder::create()
    ->in(__DIR__)
    ->exclude($excludeDirs)
    ->ignoreDotFiles(true)
    ->ignoreVCS(true)
    ->filter(function (\SplFileInfo $file) use ($excludeFiles) {
        return ! in_array($file->getRelativePathName(), $excludeFiles);
    })
;

return Cartalyst\PhpCsFixer\Config::create()->setFinder($finder);



// Create a new CS Fixer Finder instance
$finder = PhpCsFixer\Finder::create()->in(__DIR__);

return Cartalyst\PHPCsFixer\Config::create()
    ->setFinder($finder)
    ->withPHPUnitRules()
;