php-cs-fixer fix).php-cs-fixer (composer require friendsofphp/php-cs-fixer) and reference the config in .php-cs-fixer.dist.php:
<?php
return (new PhpCsFixer\Config())
->setRules(Azuyalabs\PhpCsFixerConfig::getRules())
->setFinder(...);
artisan make:controller can auto-format via hooks)..php-cs-fixer.dist.php.php-cs-fixer as a dev dependency (minor impact).phpmd, eslint for JS)?php-cs-fixer runs slow down CI? (Test with --dry-run first.)laravel/php-cs-fixer-config)?laravel-shift/php-cs-fixer for deeper Laravel integration (e.g., auto-fixing in artisan).pre-commit hooks (e.g., via husky) to block non-compliant commits.php-cs-fixer fix --dry-run to identify potential issues..php_cs or .editorconfig files..php-cs-fixer.dist.php to use the preset.composer.json scripts:
"scripts": {
"cs-fix": "php-cs-fixer fix",
"cs-check": "php-cs-fixer fix --dry-run --diff"
}
spatie/laravel-permission) to ensure their code adheres.azuyalabs/php-cs-fixer-config to a specific version to avoid rule changes:
"require-dev": {
"azuyalabs/php-cs-fixer-config": "^1.0"
}
php-cs-fixer is installed (^3.0 recommended).phpstan.neon, rector).CONTRIBUTING.md.composer cs-fix..php-cs-fixer-ignore file for edge cases.php-cs-fixer versions if the preset becomes incompatible.cs-fix locally first..php-cs-fixer.dist.php.--parallel flag for faster runs.vendor/ and .php-cs-fixer.cache/ in CI.composer cs-check is fast enough for PRs.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Config breaks existing code | PRs blocked, developer frustration | Run dry-run pre-merge; override rules. |
| CI flakes due to slow runs | Build timeouts | Cache dependencies; parallelize. |
| Rule updates break compatibility | Existing code fails checks | Pin config version; test upgrades. |
| Team ignores the config | Inconsistent style | Enforce in CI; pair with code reviews. |
php-cs-fixer workflows (local fixes, CI checks).composer cs-fix # Auto-fix files
composer cs-check # Validate without fixing
composer cs-diff # Show changes
How can I help you explore Laravel packages today?