A PHP 8.4+ library that provides the shared MATRAUX PHP-CS-Fixer configuration.
It exposes a ready-to-use ConfigFactory for project .php-cs-fixer.dist.php files and reusable Rules presets for custom configurations.
Useful for keeping code style, imports, strict typing, class layout, PHPDoc cleanup, indentation, and line endings consistent across multiple PHP packages.
- Ready-to-use PHP-CS-Fixer configuration via
ConfigFactory::create() - Reusable rules through
Rules::Alland grouped rule sets - PER-CS baseline with automatic PHP migration rules
- Strict typing, strict comparisons, strict parameters, and function alias cleanup
- Import ordering, unused import removal, and fully qualified type normalization
- Class member ordering and class element separation
- Tabs and LF line endings configured by default
- Risky PHP-CS-Fixer rules enabled explicitly
- Stable cache file per configured path set
composer require --dev matraux/php-code-style| version | PHP | Note |
|---|---|---|
| 1.0.0 | 7.4+ | Support PHP 7.4 |
| 2.0.0 | 8.3+ | Support PHP 8.3 |
| 3.0.0 | 8.4+ | Support PHP 8.4 |
Create file .php-cs-fixer.dist.php or .php-cs-fixer.php in root.
<?php declare(strict_types=1);
use Matraux\PhpCodeStyle\ConfigFactory;
return ConfigFactory::create(
__DIR__ . '/src',
);Run code style check
vendor/bin/php-cs-fixer checkRun code style fixer
vendor/bin/php-cs-fixer fixSee Development for debug, static analysis, and coding standards.
For bug reports and feature requests, please use the issue tracker.