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

Laminas Coding Standard Laravel Package

laminas/laminas-coding-standard

Provides Laminas PHP coding standard rules and tooling to enforce consistent code style and quality across projects, integrating with CI to automate checks and help teams follow Laminas conventions.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing via Composer: composer require --dev laminas/laminas-coding-standard. Once installed, PHPCS will automatically register the Laminas standard (no manual config needed). Run ./vendor/bin/phpcs on your codebase to see violations. The first use case is typically running a one-time check on an existing project to identify style violations, then adding phpcs to local pre-commit hooks or CI (e.g., GitHub Actions) for automated enforcement. Check vendor/laminas/laminas-coding-standard/Laminas/ruleset.xml for the default sniff list and configuration.

Implementation Patterns

  • Base configuration: Create a phpcs.xml in your project root to extend Laminas and customize rules (e.g., exclude vendor, set paths, adjust severity).
    <?xml version="1.0"?>
    <ruleset name="MyProject">
      <rule ref="Laminas"/>
      <file>src</file>
      <exclude-pattern>*/migrations/*</exclude-pattern>
    </ruleset>
    
  • CI integration: Add a step like ./vendor/bin/phpcs --error-severity=5 --warning-severity=5 in your pipeline to fail on errors/warnings.
  • IDE integration: Configure PHP_CodeSniffer in PhpStorm/VS Code to use the Laminas standard for live feedback.
  • Custom sniffs: Extend Laminas_Sniffs_* classes to add project-specific rules (e.g., enforcing database query conventions).
  • Merging standards: Combine with other standards (e.g., PSR12) using <rule ref="PSR12"/> and <exclude name="Laminas..."/> where needed.

Gotchas and Tips

  • PHPCS version compatibility: Ensure squizlabs/php_codesniffer ≥3.7. Use phpcs --version and composer show laminas/laminas-coding-standard to verify. Older PHPCS versions may misinterpret rule exclusions.
  • False positives in PHP 8+: Some sniffs may not yet fully support PHP 8 features like union types or named arguments—use <exclude name="..."/> selectively or override with custom sniffs.
  • Rule hierarchy matters: Avoid duplicating rules (e.g., Laminas includes PSR12), which can cause conflicting messages. Use phpcs -i to list installed standards and confirm Laminas is registered.
  • Performance: Large codebases benefit from running phpcs --parallel=8 or splitting into chunks. Monitor CI time—add caching for PHPCS (e.g., vendor/ cache key).
  • Migration tip: Start with --report-diff to auto-fix what’s safe, then manually fix remaining issues. Use --report-summary to quantify violations before/after.
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