fabpot / php-cs-fixer
A tool to automatically fix PHP code style
Fund package maintenance!
keradus
Installs: 5 410 508
Dependents: 854
Suggesters: 5
Security: 0
Stars: 13 310
Watchers: 204
Forks: 1 618
Open Issues: 89
Type:application
Requires
- php: ^7.4 || ^8.0
- ext-filter: *
- ext-hash: *
- ext-json: *
- ext-tokenizer: *
- clue/ndjson-react: ^1.3
- composer/semver: ^3.4
- composer/xdebug-handler: ^3.0.5
- fidry/cpu-core-counter: ^1.3
- react/child-process: ^0.6.6
- react/event-loop: ^1.5
- react/promise: ^3.3
- react/socket: ^1.16
- react/stream: ^1.4
- sebastian/diff: ^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0
- symfony/console: ^5.4.47 || ^6.4.24 || ^7.0
- symfony/event-dispatcher: ^5.4.45 || ^6.4.24 || ^7.0
- symfony/filesystem: ^5.4.45 || ^6.4.24 || ^7.0
- symfony/finder: ^5.4.45 || ^6.4.24 || ^7.0
- symfony/options-resolver: ^5.4.45 || ^6.4.24 || ^7.0
- symfony/polyfill-mbstring: ^1.33
- symfony/polyfill-php80: ^1.33
- symfony/polyfill-php81: ^1.33
- symfony/process: ^5.4.47 || ^6.4.24 || ^7.2
- symfony/stopwatch: ^5.4.45 || ^6.4.24 || ^7.0
Requires (Dev)
- facile-it/paraunit: ^1.3.1 || ^2.7
- infection/infection: ^0.29.14
- justinrainbow/json-schema: ^6.5
- keradus/cli-executor: ^2.2
- mikey179/vfsstream: ^1.6.12
- php-coveralls/php-coveralls: ^2.8
- php-cs-fixer/phpunit-constraint-isidenticalstring: ^1.6
- php-cs-fixer/phpunit-constraint-xmlmatchesxsd: ^1.6
- phpunit/phpunit: ^9.6.25 || ^10.5.53 || ^11.5.34
- symfony/polyfill-php84: ^1.33
- symfony/var-dumper: ^5.4.48 || ^6.4.24 || ^7.3.2
- symfony/yaml: ^5.4.45 || ^6.4.24 || ^7.3.2
Suggests
- ext-dom: For handling output formats in XML
- ext-mbstring: For handling non-UTF8 characters.
- dev-master
- v3.87.1
- v3.87.0
- v3.86.0
- v3.85.1
- v3.85.0
- v3.84.0
- v3.83.0
- v3.82.2
- v3.82.1
- v3.82.0
- v3.81.0
- v3.80.0
- v3.79.0
- v3.78.1
- v3.78.0
- v3.77.0
- v3.76.0
- v3.75.0
- v3.74.0
- v3.73.1
- v3.73.0
- v3.72.0
- v3.71.0
- v3.70.2
- v3.70.1
- v3.70.0
- v3.69.1
- v3.69.0
- v3.68.5
- v3.68.4
- v3.68.3
- v3.68.2
- v3.68.1
- v3.68.0
- v3.67.1
- v3.67.0
- v3.66.2
- v3.66.1
- v3.66.0
- v3.65.0
- v3.64.0
- v3.63.2
- v3.63.1
- v3.63.0
- v3.62.0
- v3.61.1
- v3.61.0
- v3.60.0
- v3.59.3
- v3.59.2
- v3.59.1
- v3.59.0
- v3.58.1
- v3.58.0
- v3.57.2
- v3.57.1
- v3.57.0
- v3.56.2
- v3.56.1
- v3.56.0
- v3.55.0
- v3.54.0
- v3.53.0
- v3.52.1
- v3.52.0
- v3.51.0
- v3.50.0
- v3.49.0
- v3.48.0
- v3.47.1
- v3.47.0
- v3.46.0
- v3.45.0
- v3.44.0
- v3.43.1
- v3.43.0
- v3.42.0
- v3.41.1
- v3.41.0
- v3.40.2
- v3.40.1
- v3.40.0
- v3.39.1
- v3.39.0
- v3.38.2
- v3.38.1
- v3.38.0
- v3.37.1
- v3.37.0
- v3.36.0
- v3.35.1
- v3.35.0
- v3.34.1
- v3.34.0
- v3.33.1
- v3.33.0
- v3.32.1
- v3.32.0
- v3.31.0
- v3.30.0
- v3.29.0
- v3.28.0
- v3.27.0
- v3.26.1
- v3.26.0
- v3.25.1
- v3.25.0
- v3.24.0
- v3.23.0
- v3.22.0
- v3.21.3
- v3.21.2
- v3.21.1
- v3.21.0
- v3.20.0
- v3.19.2
- v3.19.1
- v3.19.0
- v3.18.0
- v3.17.0
- v3.16.0
- v3.15.1
- v3.15.0
- v3.14.5
- v3.14.4
- v3.14.3
- v3.14.2
- v3.14.1
- v3.14.0
- v3.13.2
- v3.13.1
- v3.13.0
- v3.12.0
- v3.11.0
- v3.10.0
- v3.9.6
- v3.9.5
- v3.9.4
- v3.9.3
- v3.9.2
- v3.9.1
- v3.8.0
- v3.7.0
- v3.6.0
- v3.5.0
- v3.4.0
- v3.3.2
- v3.3.1
- v3.3.0
- v3.2.1
- v3.2.0
- v3.1.0
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v3.0.0-rc.1
- v3.0.0-beta.2
- v3.0.0-beta.1
- v2.19.3
- v2.19.2
- v2.19.1
- v2.19.0
- v2.18.7
- v2.18.6
- v2.18.5
- v2.18.4
- v2.18.3
- v2.18.2
- v2.18.1
- v2.18.0
- v2.17.5
- v2.17.4
- v2.17.3
- v2.17.2
- v2.17.1
- v2.17.0
- v2.16.10
- v2.16.9
- v2.16.8
- v2.16.7
- v2.16.6
- v2.16.5
- v2.16.4
- v2.16.3
- v2.16.2
- v2.16.1
- v2.16.0
- v2.15.10
- v2.15.9
- v2.15.8
- v2.15.7
- v2.15.6
- v2.15.5
- v2.15.4
- v2.15.3
- v2.15.2
- v2.15.1
- v2.15.0
- v2.14.6
- v2.14.5
- v2.14.4
- v2.14.3
- v2.14.2
- v2.14.1
- v2.14.0
- v2.13.3
- v2.13.2
- v2.13.1
- v2.13.0
- v2.12.12
- v2.12.11
- v2.12.10
- v2.12.9
- v2.12.8
- v2.12.7
- v2.12.6
- v2.12.5
- v2.12.4
- v2.12.3
- v2.12.2
- v2.12.1
- v2.12.0
- v2.11.2
- v2.11.1
- v2.11.0
- v2.10.5
- v2.10.4
- v2.10.3
- v2.10.2
- v2.10.1
- v2.10.0
- v2.9.3
- v2.9.2
- v2.9.1
- v2.9.0
- v2.8.4
- v2.8.3
- v2.8.2
- v2.8.1
- v2.8.0
- v2.7.5
- v2.7.4
- v2.7.3
- v2.7.2
- v2.7.1
- v2.7.0
- v2.6.1
- v2.6.0
- v2.5.1
- v2.5.0
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.20
- v2.2.19
- v2.2.18
- v2.2.17
- v2.2.16
- v2.2.15
- v2.2.14
- v2.2.13
- v2.2.12
- v2.2.11
- v2.2.10
- v2.2.9
- v2.2.8
- v2.2.7
- v2.2.6
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.1
- v2.0.0
- v2.0.0-RC
- v2.0.0-beta
- v2.0.0-alpha
- v1.13.3
- v1.13.2
- v1.13.1
- v1.13.0
- v1.12.4
- v1.12.3
- v1.12.2
- v1.12.1
- v1.12.0
- v1.11.8
- v1.11.7
- v1.11.6
- v1.11.5
- v1.11.4
- v1.11.3
- v1.11.2
- v1.11.1
- v1.11
- v1.10.3
- v1.10.2
- v1.10.1
- v1.10
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9
- v1.8.1
- v1.8
- v1.7.1
- v1.7
- v1.6.2
- v1.6.1
- v1.6
- v1.5.2
- v1.5.1
- v1.5
- v1.4.2
- v1.4.1
- v1.4
- v1.3
- v1.2
- v1.1
- v1.0
- v0.5.7
- v0.5.6
- v0.5.5
- v0.5.4
- v0.5.3
- v0.5.2
- v0.5.1
- v0.5.0
- v0.4.0
- v0.3.0
- v0.2.0
- v0.1.0
- dev-chore_
- dev-docs_
- dev-Tokens
- dev-release_notes_template
- dev-revert-8927-type3
This package is auto-updated.
Last update: 2025-09-03 10:14:35 UTC
README
PHP Coding Standards Fixer
The PHP Coding Standards Fixer (PHP CS Fixer) fixes your code to follow the standards.
If you are already using a linter to identify coding standards problems in your code, you know that fixing them by hand is tedious, especially on large projects. This tool not only detects them, but also fixes them for you.
PHP CS Fixer has built-in rule sets, whether you want to follow PHP coding standards as defined by PHP-FIG's PER Coding Style, a wide community like the Symfony, or our opinionated one. You can also define your (team's) style through the configuration file.
PHP CS Fixer can not only unify the style of your code, but also help to modernize your codebase towards
newer PHP (e.g. @PHP85Migration
) and newer PHPUnit (e.g. @PHPUnit91Migration:risky
).
Supported PHP Versions
- PHP 7.4 - PHP 8.4
Note
Each new PHP version requires a huge effort to support the new syntax.
That's why the latest PHP version might not be supported yet. If you need it,
please consider supporting the project in any convenient way, for example,
with code contributions or reviewing existing PRs. To run PHP CS Fixer on yet
unsupported versions "at your own risk" - use --allow-unsupported-php-version=yes
option.
Documentation
Installation
The recommended way to install PHP CS Fixer is to use Composer:
composer require --dev friendsofphp/php-cs-fixer
## or when facing conflicts in dependencies:
composer require --dev php-cs-fixer/shim
For more details and other installation methods (also with Docker or behind CI), see installation instructions.
Usage
Assuming you installed PHP CS Fixer as instructed above, you can run the
following command to fix the PHP files in the src
directory:
./vendor/bin/php-cs-fixer fix src
See usage, list of built-in rules, list of rule sets and configuration file documentation for more details.
If you need to apply code styles that are not supported by the tool, you can create custom rules.
Editor Integration
Native support exists for:
Community plugins exist for:
Community
The PHP CS Fixer is maintained on GitHub at https://github.com/PHP-CS-Fixer/PHP-CS-Fixer. Contributions, bug reports and ideas about new features are welcome there.
You can reach us in the GitHub Discussions regarding the project, configuration, possible improvements, ideas and questions.
Contribute
The tool comes with quite a few built-in fixers, but everyone is more than welcome to contribute more of them.