https://github.com/valantic/php-cs-fixer-config
https://github.com/valantic/php-cs-fixer-config
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/valantic/php-cs-fixer-config
- Owner: valantic
- License: mit
- Created: 2023-04-11T16:24:14.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-07-14T12:05:50.000Z (12 months ago)
- Last Synced: 2025-08-12T11:41:44.296Z (11 months ago)
- Language: PHP
- Size: 46.9 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PHP-CS-Fixer Config for valantic Projects
[](https://packagist.org/packages/valantic/php-cs-fixer-config)
[](https://github.com/valantic/php-cs-fixer-config/actions/workflows/phpunit.yml)
[](https://github.com/valantic/php-cs-fixer-config/actions/workflows/rector.yml)
[](https://github.com/valantic/php-cs-fixer-config/actions/workflows/php-cs-fixer.yml)
[](https://github.com/valantic/php-cs-fixer-config/actions/workflows/phpstan.yml)
[](https://packagist.org/packages/valantic/php-cs-fixer-config)
This package provides standard PHP-CS-Fixer configurations used in projects built by Valantic.
## Installation
```bash
composer require --dev valantic/php-cs-fixer-config friendsofphp/php-cs-fixer
```
> **Note:** This package requires PHP 8.1 or higher.
> **Note:** `friendsofphp/php-cs-fixer` is _not_ a dependency as to allow the use of e.g. [the Composer bin plugin](https://github.com/bamarni/composer-bin-plugin).
## Usage
Create a `.php-cs-fixer.php` or `.php-cs-fixer.dist.php` file in your project root with one of the following configurations:
### Basic Configuration
```php
false,
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
)
// Enable risky rules (recommended as the ruleset includes risky rules)
->setRiskyAllowed(true)
// Enable parallel execution
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
;
```
## Development
This package provides several Composer scripts to help with development:
```bash
# Run PHP-CS-Fixer in dry-run mode with diff output
composer cs-check
# Run PHP-CS-Fixer to fix code style issues
composer cs-fix
# Run PHPStan for static analysis
composer phpstan
# Run Rector in dry-run mode
composer rector-dry-run
# Run Rector and apply changes
composer rector
# Run PHPUnit tests
composer test
# Run all checks (cs-check, phpstan, rector-dry-run, test)
composer check
```