PHP code example of kaizen-agency / php-cs-rule-set

1. Go to this page and download the library: Download kaizen-agency/php-cs-rule-set 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/ */

    

kaizen-agency / php-cs-rule-set example snippets




$finder = (new PhpCsFixer\Finder())
    ->in(__DIR__)
    ->exclude([
        'vendor',
        'tests',
        // Add more directories here if needed
    ]);

return (new PhpCsFixer\Config())
    ->setRules((new KaizenAgency\PhpCsRuleSet\Config\PhpRuleSet())->getRules())
    // ->setRules((new KaizenAgency\PhpCsRuleSet\Config\Php80RuleSet())->getRules()) // Uncomment to use PHP 8.0 rules
    ->setFinder($finder)
    // ->setIndent("  ") // Uncomment to use two spaces instead of four
    ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect());
bash
composer 
bash
vendor/bin/php-cs-fixer check # Run the linter
vendor/bin/php-cs-fixer fix # Fix the code