valantic / php-cs-fixer-config
Provides a standard php-cs-fixer configuration used in projects built by Valantic.
Installs: 1 369
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 3
Requires
- php: ^8.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.82.2
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan: ^2.1.17
- phpstan/phpstan-deprecation-rules: ^2.0.3
- phpstan/phpstan-strict-rules: ^2.0.4
- phpunit/phpunit: ^12.2.6
- rector/rector: ^2.1
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2025-07-14 12:08:15 UTC
README
This package provides standard PHP-CS-Fixer configurations used in projects built by Valantic.
Installation
composer require --dev valantic/php-cs-fixer-config friendsofphp/php-cs-fixer
Note: This package requires PHP 8.1 or higher.
Note:
friendsofphp/php-cs-fixer
is not a dependency as to allow the use of e.g. the Composer bin plugin.
Usage
Create a .php-cs-fixer.php
or .php-cs-fixer.dist.php
file in your project root with one of the following configurations:
Basic Configuration
<?php require_once __DIR__ . '/vendor/autoload.php'; use Valantic\PhpCsFixerConfig\ConfigFactory; return ConfigFactory::createValanticConfig([ // Add your custom rules here 'declare_strict_types' => false, ]) ->setFinder( PhpCsFixer\Finder::create() ->in(__DIR__ . '/src') ->in(__DIR__ . '/tests') ) // Enable risky rules (recommended as the ruleset includes risky rules) ->setRiskyAllowed(true) // Enable parallel execution ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) ;
Development
This package provides several Composer scripts to help with development:
# Run PHP-CS-Fixer in dry-run mode with diff output composer cs-check # Run PHP-CS-Fixer to fix code style issues composer cs-fix # Run PHPStan for static analysis composer phpstan # Run Rector in dry-run mode composer rector-dry-run # Run Rector and apply changes composer rector # Run PHPUnit tests composer test # Run all checks (cs-check, phpstan, rector-dry-run, test) composer check