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
Coding Standard

Coding Standard Laravel Package

lcobucci/coding-standard

PHP_CodeSniffer ruleset based on Doctrine’s coding standard with small tweaks. Install and use it in your projects to enforce consistent formatting and code style via phpcs in CI and local development.

View on GitHub
Deep Wiki
Context7

Lcobucci's Coding Standard

Frequently asked questions about Coding Standard
How do I install lcobucci/coding-standard for Laravel projects?
Run `composer require --dev lcobucci/coding-standard` in your Laravel project. Ensure PHP_CodeSniffer (v4.0+) is installed via `composer require --dev squizlabs/php_codesniffer`. Configure PHPCS to use the ruleset by setting `<config name="standard" value="lcobucci"/>` in your `phpcs.xml`.
Does this package work with Laravel 10 or older?
No, this package requires PHP 8.4+ and PHPCS 4.0+, which may not be compatible with Laravel 10 or older. Upgrade to Laravel 11+ or Symfony 7+ for seamless integration. Legacy projects will need PHP and toolchain upgrades.
What are the key differences from Doctrine’s coding standard?
The ruleset is largely identical to Doctrine’s but includes minor tweaks for readability and modern PHP practices. Check the [README](https://github.com/lcobucci/coding-standard) for specifics, such as stricter array syntax or naming conventions. Override rules in `phpcs.xml` if needed.
Can I use this in CI/CD pipelines for Laravel?
Yes, it’s designed for CI/CD. Add a linting step like `phpcs -p --standard=lcobucci src/` to your workflow. Validate output format changes from PHPCS 4.0+ and ensure compatibility with existing CI tools like GitHub Actions or GitLab CI.
Will this break existing PHPCS custom rules or IDE plugins?
PHPCS 4.0+ introduces API changes that may conflict with custom rules or third-party integrations (e.g., IDE plugins). Audit your current setup for deprecated sniffs or rule classes. Override conflicting rules in `phpcs.xml` or update plugins to support PHPCS 4.0+.
How do I exclude specific files or directories from PHPCS checks?
Use the `<exclude>` tag in `phpcs.xml` to skip files or folders. Example: `<exclude name="Tests/Unit" />` or `<exclude-pattern>*.legacy.php</exclude-pattern>`. This works alongside the `lcobucci` standard without conflicts.
Is there a performance impact when running PHPCS with this ruleset?
The ruleset itself has minimal runtime overhead, but PHPCS 4.0+ may introduce slight performance changes. Test in a staging environment to validate speed, especially for large Laravel codebases. Parallel execution (`-p` flag) can mitigate delays.
How do I handle false positives in legacy Laravel code?
Override specific rules in `phpcs.xml` to downgrade severity or exclude problematic sniffs. Example: `<rule ref="lcobucci" severity="warning"><exclude name="Generic.Files.LineEndings" /></rule>`. Gradually refactor legacy code to align with the standard.
Are there alternatives to lcobucci/coding-standard for Laravel?
Yes, consider `phpcs-standard` (PSR-12), `symfony/shift/coding-standard` (Symfony’s rules), or `dealerdirect/phpcodesniffer-composer-installer` for custom setups. However, this package offers a Doctrine-aligned baseline with minor refinements, ideal for teams prioritizing consistency.
How do I migrate from doctrine/coding-standard to lcobucci/coding-standard?
Backup your current `phpcs.xml` and replace `<config name="standard" value="Doctrine" />` with `<config name="standard" value="lcobucci" />`. Test locally and in CI to catch rule deviations. Use `<exclude>` or `<rule>` tags to address conflicts incrementally.
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.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope