sylarele/php-cs-fixer-config

Our internal PHP CS Fixer config

Maintainers

Package info

github.com/sylarele/php-cs-fixer-config

pkg:composer/sylarele/php-cs-fixer-config

Statistics

Installs: 1 300

Dependents: 3

Suggesters: 0

Stars: 0

v2.0.0 2026-03-31 18:36 UTC

This package is auto-updated.

Last update: 2026-03-31 18:37:08 UTC


README

License Packagist Dependency Version Packagist Downloads

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;