facile-it/facile-coding-standard
PHP coding standard based on PHP-CS-Fixer by Facile.it. Installs via Composer with an interactive setup that generates a .php-cs-fixer.dist.php, auto-detects files from composer autoload (psr-0/psr-4/classmap), and adds cs-check/cs-fix scripts.
Install the package with composer require --dev facile-it/facile-coding-standard. Upon installation, a Composer plugin prompts for project-specific configuration (e.g., source directories) and auto-generates .php-cs-fixer.dist.php with updated defaults for PHP 8.1–8.4 (PHP 7.4 and 8.0 are no longer supported). The config now includes PER-CS 3.0 rules by default, with new additions like multiline_promoted_properties and no_redundant_readonly_property. Run composer cs-check to lint code or composer cs-fix to auto-fix—no extra setup is needed for standard Laravel projects using PSR-4 autoloading.
composer cs-check as a non-blocking lint step in pre-commit hooks or GitHub Actions. For risky rules (e.g., @PER-CS3x0:risky), explicitly enable them via .php-cs-fixer.php:
$config->setRules([
'@PER-CS3x0:risky' => true,
'no_useless_printf' => true,
]);
php-cs-fixer fix using the generated .php-cs-fixer.dist.php. Note that trailing commas now apply to all multi-line statements (not just arrays) due to PER-CS 3.0 alignment..php-cs-fixer.dist.php directly. Use .php-cs-fixer.php to override defaults, e.g.:
$config->setRiskyAllowed(true); // Enable risky rules globally
$config->setUsingCache(false); // Disable cache for monorepos
app/, database/, src/, and tests/ via Composer autoloader. Verify composer.json autoload sections are correct, as only psr-0, psr-4, and classmap are detected..php-cs-fixer.php using @PER-CS3x0:risky (replaces deprecated @PER-CS2.0:risky). New risky rules include no_useless_printf.if conditions, foreach), not just arrays. Test with composer cs-check --diff to preview changes.psr-0, psr-4, and classmap are detected; files or exclude are ignored. If files aren’t linted, verify composer.json autoload settings.$config->setUsingCache(false) in .php-cs-fixer.php.@PER-CS2.0:risky → @PER-CS3x0:risky), but always check CI logs after upgrades.composer facile-cs-create-config --no-risky to reset configs after version bumps, excluding risky rules by default.php-cs-fixer fix --dry-run --diff -vvv to trace rule behavior, especially for edge cases like promoted properties or docblock normalization.multiline_promoted_properties, no_whitespace_in_empty_array) in a staging environment before enforcing them in CI.How can I help you explore Laravel packages today?