friendsofphp/php-cs-fixer
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
composer/semver | 3.4.0 | 28.21 kB | MIT | prod | |
composer/xdebug-handler | 3.0.5 | - | MIT | prod | |
sebastian/diff | 5.1.1 | - | BSD-3-Clause | prod | |
symfony/console | v7.0.7 | - | MIT | prod | |
symfony/event-dispatcher | v7.0.7 | - | MIT | prod dev | |
symfony/filesystem | v7.0.7 | - | MIT | prod dev | |
symfony/finder | v7.0.7 | - | MIT | prod | |
symfony/options-resolver | v7.0.7 | - | MIT | prod | |
symfony/polyfill-mbstring | v1.29.0 | - | MIT | prod | |
symfony/polyfill-php80 | v1.29.0 | - | MIT | prod | |
symfony/polyfill-php81 | v1.29.0 | 4.96 kB | MIT | prod | |
symfony/process | v7.0.7 | - | MIT | prod dev | |
symfony/stopwatch | v7.0.7 | - | MIT | prod dev |
Friendsofphp/php-cs-fixer is a powerful tool used to automatically fix PHP coding standards in your codebase. This tool helps developers adhere to specific coding standards like PSR-1, PSR-2, and the Symfony coding standard, among others. Not only does it enforce coding standards, it also offers code modernization (for example, converting the pow
function to the **
operator on PHP 5.6) and micro-optimization. The PHP CS Fixer is an invaluable tool for large projects where manually correcting coding standards would be a tedious process.
In order to use Friendsofphp/php-cs-fixer, the first step involves the installation, which is best done using Composer. It's recommended to use a dedicated composer.json
file in your project. Here's a step-by-step process:
mkdir -p tools/php-cs-fixer
composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer
or you can also use the main composer.json
in your project:
composer require --dev friendsofphp/php-cs-fixer
src
), you can run:tools/php-cs-fixer/vendor/bin/php-cs-fixer fix src
Remember this will automatically fix the PHP code in the specified directory according to the set standards.
Additional details can be found in the installation instructions in the documentation.
The documentation for friendsofphp/php-cs-fixer can be found directly in the GitHub repository.
For creating custom rules, you can refer to Custom Rules Documentation. The documentation clearly elaborates how to utilize this tool effectively and make it seamlessly fit into your development process.