Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpcsextra Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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.

Implementation Patterns

  • Layered standards: Combine phpcsextra with existing standards (e.g., PSR12) by referencing both in your ruleset. Prioritize rule priorities via <rule ref="..."><severity>...</severity></rule> where needed.
  • Selective enabling: Disable noisy or incompatible sniffs (e.g., PHPCodeSnifferExtra.ControlStructures.InlineControlStructure) using <exclude> tags in your ruleset for incremental adoption.
  • CI integration: Add 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.
  • Custom sniffs extension: Use phpcsextra’s sniff templates (found in Sniffs/) as a reference when building project-specific standards.

Gotchas and Tips

  • Version locking: Since 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.
  • Cache conflicts: Clear PHP_CodeSniffer’s cache (vendor/bin/phpcbf --cache-clear) after updating phpcsextra, especially after major releases—sniff metadata changes can cause false positives.
  • Deprecated sniff groups: Version 2.x deprecated some sniff groups (e.g., PHPCodeSnifferExtra.Arrays); migrate configs to the new PHPCodeSnifferExtra.Arrays.ArrayDeclaration hierarchy per the changelog.
  • Performance impact: Some sniffs (e.g., complex docblock analysis) are expensive—consider running only critical sniffs in pre-commit hooks (via lint-staged or similar).
  • Docblock alignment: Several phpcsextra sniffs enforce strict docblock parameter ordering—ensure your IDE (e.g., PHPStan, PHPDoc annotations) aligns with these expectations to avoid constant rewrites.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport