My PHP CS Fixer rules
Find a file
2025-11-30 13:55:40 +10:00
scripts build: add a publish script 2025-11-30 12:06:12 +10:00
src feat!: Extract the risky rules to a separate rule set 2025-11-30 10:32:28 +10:00
.editorconfig build: add lefthook and commitlint 2025-11-30 10:40:23 +10:00
.gitignore build: add a publish script 2025-11-30 12:06:12 +10:00
.php-cs-fixer.php feat!: Extract the risky rules to a separate rule set 2025-11-30 10:32:28 +10:00
bun.lock build: add lefthook and commitlint 2025-11-30 10:40:23 +10:00
commitlint.config.js build: add lefthook and commitlint 2025-11-30 10:40:23 +10:00
composer.json chore: bump version to 2.0.1 2025-11-30 11:34:31 +10:00
lefthook.yml build: add lefthook and commitlint 2025-11-30 10:40:23 +10:00
LICENSE feat: create ruleset 2025-10-18 14:39:16 +10:00
package.json build: add lefthook and commitlint 2025-11-30 10:40:23 +10:00
phpstan.neon build: add PHPStan and Composer Normalize 2025-10-18 14:47:01 +10:00
publish.env.example build: add a publish script 2025-11-30 12:06:12 +10:00
README.md docs: add reference to the Forgejo composer registry 2025-11-30 13:55:40 +10:00

My PHP CS Fixer rules

Packagist Version Packagist Downloads PHP Version

My custom rulesets for PHP CS Fixer 3.88+.

It's based on PER-CS3 and Nuno Maduro's Essentials package.

Installation

Install through Composer:

composer require --dev rvxlab/php-cs-fixer-rules

This package is also available through Forgejo. Add the following repository, then require the package:

{
    "type": "composer",
    "url": "https://code.rvx.works/api/packages/RVxLab/composer"
}

In your .php-cs-fixer.php register the rulesets and enable them:

return (new PhpCsFixer\Config())
    ->registerCustomRuleSets([
        new RVxLab\PhpCsFixerRules\RuleSet(),
        new RVxLab\PhpCsFixerRules\RuleSetRisky(),
    ])
    ->setRiskyAllowed(true)
    ->setRules([
        RVxLab\PhpCsFixerRules\RuleSet::NAME => true,
        RVxLab\PhpCsFixerRules\RuleSetRisky::NAME => true,
    ]);

License

This package is licensed under the MIT License.