Weave 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

Phpcsdevcs Laravel Package

phpcsstandards/phpcsdevcs

phpcsdevcs provides a set of PHP_CodeSniffer rules and configuration to enforce consistent coding standards across PHP projects. Drop-in standards for PHPCS with sensible defaults, helping teams catch style issues early and keep code clean and uniform.

View on GitHub
Deep Wiki
Context7

Getting Started

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.

Implementation Patterns

  • Dev-time only: Include PHPDevCS in your development-only ruleset (e.g., phpcs-dev.xml). Exclude it from production CI that analyzes application code.
  • Sniff template integration: Use it in your custom sniff skeleton or project templates (e.g., via squizlabs/php_codesniffer-template) to ensure new sniffs conform to PHPCS conventions.
  • CI workflow: Add a dedicated CI job that runs PHPCS with PHPDevCS on src/Sniffs/ to catch violations in your sniffs before merging.
  • Extended rulesets: Build upon 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).

Gotchas and Tips

  • Misleading name: Despite the name, you don’t need to be a PHPCS core developer—just writing any custom sniff benefits from this ruleset.
  • No target project sniffing: It will incorrectly flag your project code if used naively. Always scope its usage to --standard=PHPDevCS src/Sniffs/.
  • Strict DocBlock requirements: Enforces detailed @since, @link, and method-level annotations—use PHPDoc templates to reduce boilerplate.
  • Method visibility: Enforces protected for helper methods; violating this is common in early-stage sniff dev—review violations carefully before suppressing.
  • Test coverage integration: Combine with phpunit + phpcsdevcs in your test suite to catch style issues in test sniffs (e.g., your SniffTest.php implementations) too.
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.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log