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
Code Sniffer

Code Sniffer Laravel Package

php-collective/code-sniffer

PHP_CodeSniffer ruleset from PhpCollective: PSR-2 compliant with many extra sniffs/fixers (incl. PSR-12). Install via composer, add the provided ruleset to phpcs.xml, and run phpcs/phpcbf (or composer scripts) to check and auto-fix coding style.

View on GitHub
Deep Wiki
Context7

PhpCollective Code Sniffer Standards

Frequently asked questions about Code Sniffer
How do I install php-collective/code-sniffer for Laravel?
Add it as a dev dependency with `composer require --dev php-collective/code-sniffer`, then configure `phpcs.xml` to reference `PhpCollective/ruleset.xml`. No Laravel-specific setup is needed beyond standard PHP_CodeSniffer integration.
Does this package support Laravel’s PSR-2/PSR-12 conventions?
Yes, it fully adheres to PSR-2 and includes PSR-12 sniffs. It’s designed to complement Laravel’s existing coding standards without conflicts, making it a natural fit for Laravel projects.
Can I auto-fix code style issues in Laravel?
Absolutely. Use `phpcbf` (auto-fixer) alongside `phpcs` (sniffer) or run `composer cs-fix` if you’ve set up the Composer script. It supports all the same rules as `phpcs` for auto-correction.
What’s the difference between PhpCollective and PhpCollectiveStrict?
PhpCollectiveStrict is a stricter subset of the standard with additional rules (e.g., stricter use statements). Use it for teams needing higher coding discipline, but start with PhpCollective for gradual adoption.
Will this work with Laravel 9+ and PHP 8.1+?
Yes, the package requires PHP 8.1+ and is fully compatible with Laravel 9+. Older Laravel versions may need minor adjustments, but no breaking changes are expected for modern setups.
How do I integrate this with PHPStorm or VSCode?
Configure an external tool in PHPStorm (e.g., `vendor/bin/phpcs`) or use VSCode’s PHP_CodeSniffer extension. The package provides IDE-friendly rulesets, so real-time linting and fixes work out of the box.
Can I customize or override rules for Laravel-specific cases?
Yes, override any rule in `phpcs.xml` (e.g., disable `DocBlockTagOrder` for legacy code). The package supports project-specific sniffs, and Laravel’s class aliases (e.g., `Mockery`) can be whitelisted.
How does this perform on large Laravel apps (e.g., 10k+ lines)?
Optimized for speed—scanning 11k-line controllers takes ~6s vs. ~40s with unoptimized setups. Use `--parallel=16` in CI for further speedups, but test locally first to avoid false positives.
Should I use this alongside PHPStan or PHP-CS-Fixer?
Yes! Pair it with PHPStan (level 8+) for static analysis and PHP-CS-Fixer for auto-formatting. This package includes `phpcbf` for fixes, but you can run both tools in CI for comprehensive checks.
What’s the migration path for existing Laravel projects?
Start by adding the package to `composer.json` and configuring `phpcs.xml`. Run `composer cs-check` in staging to identify violations, then incrementally apply fixes. Use Git hooks or CI to enforce rules pre-merge.
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.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle