sylarele / php-cs-fixer-config
Our internal PHP CS Fixer config
v2.0.0
2026-03-31 18:36 UTC
Requires
- php: ^8.3|^8.4|^8.5
- friendsofphp/php-cs-fixer: ^3.94
Requires (Dev)
This package is auto-updated.
Last update: 2026-03-31 18:37:08 UTC
README
Configuration for https://github.com/FriendsOfPhp/PHP-CS-Fixer
Installation
composer require --dev sylarele/php-cs-fixer-config
Usage
Configuration
Create a configuration file .php-cs-fixer.php in the root of your project:
<?php declare(strict_types=1); use PhpCsFixer\Finder; use PhpCsFixer\Runner\Parallel\ParallelConfig; use Sylarele\PhpCsFixerConfig\Config; $finder = Finder::create() ->exclude('storage') ->in(__DIR__) ->append([ __FILE__, ]); $config = new Config(); return $config ->setCacheFile(__DIR__.'/storage/tmp/php-cs-fixer/.php-cs-fixer.cache') ->setFinder($finder) ->setUsingCache(true) ->setParallelConfig(new ParallelConfig(6, 80));
Custom configuration
You may extend these rules and apply your own extra rules.
Create a configuration file .php-cs-fixer.php in the root of your project:
<?php declare(strict_types=1); use PhpCsFixer\Finder; use PhpCsFixer\Runner\Parallel\ParallelConfig; $finder = Finder::create() ->exclude('storage') ->in(__DIR__) ->append([ __FILE__, ]); $config = new class() extends PhpCsFixer\Config { public function __construct() { parent::__construct('Customized Sylarele'); $this->setRiskyAllowed(true); } public function getRules(): array { $rules = (new Sylarele\PhpCsFixerConfig\Config())->getRules(); // Update the rules table here return $rules; } }; $config->setFinder($finder); return $config;