composer require --dev friendsofphp/php-cs-fixer kaizen-agency/php-cs-rule-set
In .php-cs-fixer.dist.php
:
<?php
$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());
vendor/bin/php-cs-fixer check # Run the linter
vendor/bin/php-cs-fixer fix # Fix the code