phpcsstandards/phpcsextra
PHPCSExtra adds extra rules, sniffs, and tooling to enhance PHP_CodeSniffer code style checks. Designed to complement existing standards, it helps catch more issues, enforce consistency, and integrate smoothly into CI for cleaner PHP codebases.
Install via Composer: composer require --dev phpcsstandards/phpcsextra. Configure PHP_CodeSniffer to use the extra standards by adding them to your phpcs.xml or phpcs.xml.dist file—look for the <config name="installed_paths" value="vendor/phpcsstandards/phpcsextra"/> directive. Then specify the standard(s) in your ruleset, e.g., <rule ref="PHPCodeSnifferExtra"/>. Start by targeting one sniff group (e.g., PHPCodeSnifferExtra.NamingConventions) to avoid overwhelming changes.
phpcsextra with existing standards (e.g., PSR12) by referencing both in your ruleset. Prioritize rule priorities via <rule ref="..."><severity>...</severity></rule> where needed.PHPCodeSnifferExtra.ControlStructures.InlineControlStructure) using <exclude> tags in your ruleset for incremental adoption.vendor/bin/phpcs with your configured ruleset to your build pipeline; phpcsextra sniffs often highlight deprecated usage, inconsistent array syntax ([] vs array()), and style deviations early.phpcsextra’s sniff templates (found in Sniffs/) as a reference when building project-specific standards.phpcsextra is actively developed, pair it with pinned versions of phpcs/phpcs (e.g., ^3.7 or ^3.8) to avoid breaking changes in CI.vendor/bin/phpcbf --cache-clear) after updating phpcsextra, especially after major releases—sniff metadata changes can cause false positives.PHPCodeSnifferExtra.Arrays); migrate configs to the new PHPCodeSnifferExtra.Arrays.ArrayDeclaration hierarchy per the changelog.lint-staged or similar).phpcsextra sniffs enforce strict docblock parameter ordering—ensure your IDE (e.g., PHPStan, PHPDoc annotations) aligns with these expectations to avoid constant rewrites.How can I help you explore Laravel packages today?