gomzyakov / php-cs-fixer-config
Code style configuration for `php-cs-fixer` based on PSR-12.
Installs: 21 313
Dependents: 2
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 2
Open Issues: 0
Type:package
Requires
- php: ^8.3
- ext-json: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.53
- mockery/mockery: ^1.6
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^11.1
- dev-main
- v1.51.0
- v1.50.0
- v1.49.0
- v1.48.0
- v1.47.0
- v1.46.0
- v1.45.0
- v1.44.0
- v1.43.0
- v1.42.0
- v1.41.0
- v1.40.0
- v1.39.0
- v1.38.0
- v1.37.0
- v1.36.0
- v1.35.0
- v1.34.0
- v1.33.0
- v1.32.0
- v1.31.0
- v1.30.0
- v1.29.0
- v1.28.0
- v1.27.0
- v1.26.0
- v1.25.0
- v1.24.0
- v1.23.0
- v1.22.0
- v1.21.0
- v1.20.0
- v1.19.0
- v1.18.0
- v1.17.1
- v1.17.0
- v1.16.0
- v1.15.0
- v1.14.0
- v1.13.1
- v1.13.0
- v1.12.0
- v1.11.0
- v1.10.0
- v1.9.1
- v1.9.0
- v1.8.0
- v1.7.0
- v1.6.0
- v1.5.0
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.3.0
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.1
- v0.1.0
- dev-renovate/phpunit-phpunit-11.x-lockfile
- dev-renovate/composer-2.x
This package is auto-updated.
Last update: 2024-04-26 07:41:37 UTC
README
This package allows sharing identical php-cs-fixer formatting rules across all of your projects without copy-and-pasting configuration files.
Quickstart
Step 1 of 3
Install friendsofphp/php-cs-fixer
& this package via Composer:
composer require --dev friendsofphp/php-cs-fixer gomzyakov/php-cs-fixer-config
Step 2 of 3
Then create file .php-cs-fixer.dist.php
at the root of your project with following contents:
<?php use Gomzyakov\CS\Finder; use Gomzyakov\CS\Config; // Routes for analysis with `php-cs-fixer` $routes = ['./src', './tests']; return Config::createWithFinder(Finder::createWithRoutes($routes));
Change the value of $routes
depending on where your project's source code is.
Step 3 of 3
And that's it! You can now find code style violations with following command:
./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --dry-run
And then completely fix them all with:
./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php
Configuration
You must pass a set of routes to the Finder::createWithRoutes()
call. For example, for Laravel projects, this would be:
Finder::createWithRoutes(['./app', './config', './database', './resources', './routes', './tests'])
Also, you can pass a custom set of rules to the Config::createWithFinder()
call:
Config::createWithFinder($finder, [ '@PHP81Migration' => true, 'array_indentation' => false ])
Laravel Pint
The following describes the use of styles in conjunction with friendsofphp/php-cs-fixer
. Also you can use these style settings for Laravel Pint.
Support
If you find any package errors, please, make an issue in current repository.
License
This is open-sourced software licensed under the MIT License.