phpcsstandards/phpcsdevcs
Opinionated PHP_CodeSniffer rules and tooling for consistent, modern PHP codebases. Includes custom standards and configs aimed at improving readability, preventing common pitfalls, and keeping teams aligned with automated linting in CI and local development.
This package provides a ruleset (named PHPDevCS) specifically for developers writing custom PHPCS sniffs. Begin by installing it via Composer:
composer require --dev phpcsstandards/phpcsdevcs
Then, reference it in your custom ruleset XML (e.g., ruleset.xml) to lint your own sniffs during development:
<rule ref="PHPDevCS" />
It enforces best practices and coding standards within sniff code itself—not project code—making it ideal for contributors to PHPCS-ecosystem projects or those building internal sniff libraries.
PHPDevCS in your development-only ruleset (e.g., phpcs-dev.xml). Exclude it from production CI that analyzes application code.squizlabs/php_codesniffer-template) to ensure new sniffs conform to PHPCS conventions.PHPDevCS on src/Sniffs/ to catch violations in your sniffs before merging.PHPDevCS in your custom ruleset to override or relax specific rules while retaining core sniff-development checks (e.g., protected vs private methods, DocBlock conventions).--standard=PHPDevCS src/Sniffs/.@since, @link, and method-level annotations—use PHPDoc templates to reduce boilerplate.protected for helper methods; violating this is common in early-stage sniff dev—review violations carefully before suppressing.phpunit + phpcsdevcs in your test suite to catch style issues in test sniffs (e.g., your SniffTest.php implementations) too.How can I help you explore Laravel packages today?