gomzyakov / php-style
Code style configuration for `php-cs-fixer` based on PSR-12.
Installs: 1 174
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 3
Open Issues: 0
Type:package
Requires
- php: ^8.3
- ext-json: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.62
- mockery/mockery: ^1.6
- phpstan/phpstan: ^1.12
- phpunit/phpunit: ^11.3
- dev-main
- v1.77.1
- v1.77.0
- v1.76.0
- v1.75.0
- v1.74.0
- v1.73.0
- v1.72.0
- v1.71.0
- v1.70.0
- v1.69.0
- v1.68.0
- v1.67.0
- v1.66.0
- v1.65.0
- v1.64.0
- v1.63.0
- v1.62.0
- v1.61.0
- v1.60.0
- v1.59.0
- v1.58.0
- v1.57.0
- v1.56.0
- v1.55.0
- v1.54.0
- v1.53.0
- v1.52.0
- 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-dependabot/composer/symfony/process-7.1.7
This package is auto-updated.
Last update: 2024-11-07 04:23:20 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.