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

Zend Coding Standard Laravel Package

zendframework/zend-coding-standard

Zend Framework Coding Standard ruleset for PHP_CodeSniffer to enforce ZF repository style, with composer scripts for checking (phpcs) and auto-fixing (phpcbf). Note: repository abandoned; moved to laminas/laminas-coding-standard.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing the package as a dev dependency:

composer require --dev zendframework/zend-coding-standard

Add Composer scripts for checking and fixing coding standards (cs-check/cs-fix) in composer.json. Create a phpcs.xml file in your project root that references the included ruleset (./vendor/zendframework/zend-coding-standard/ruleset.xml) and defines the paths to lint (e.g., src, test). Run composer cs-check to see violations, then composer cs-fix to auto-correct many issues.

⚠️ Critical note: This package is archived (discontinued). All development has moved to laminas/laminas-coding-standard. For any new project or active maintenance, use the Laminas fork instead.

Implementation Patterns

  • Project-wide enforcement: Integrate into CI/CD pipelines (e.g., GitHub Actions, GitLab CI) to fail builds on CS violations.
  • Editor/IDE integration: Use PHP_CodeSniffer plugins (e.g., VS Code PHP Sniffer, PhpStorm inspections) to get real-time feedback.
  • Custom ruleset extension: Override or add rules in phpcs.xml (e.g., <rule ref="ZendFramework.Sniffs.Arrays.ArrayStructuralSniff"> to disable short arrays if needed, or relax specific strict checks).
  • Targeted checks: Exclude third-party code (e.g., <file>vendor/</file> with exclusion <exclude-pattern>*/vendor/*</exclude-pattern>) and run checks on specific directories via phpcs src/.

For legacy Zend Framework/Laminas projects, this package enforces a strict superset of PSR-12 with Zend/Laminas-specific conventions like mandatory declare(strict_types=1), no long array syntax, consistent self:: usage, and disciplined docblock formatting.

Gotchas and Tips

  • Archived status: This package is unmaintained (last release: 2019-11-05). Switch to laminas/laminas-coding-standard for continued updates and PHP 8+ compatibility.
  • Whitespace quirks: The sniff for superfluous whitespace is aggressive — it flags trailing spaces, extra blank lines, and inconsistent array indentation. Use phpcbf liberally but verify manually, especially in multiline arrays (requires 4-space indent, trailing commas).
  • global keyword: Explicitly forbidden. If legacy code uses it, temporarily <rule ref="ZendFramework.CodeAnalysis.GlobalKeywordSniff" severity="0"/> in phpcs.xml.
  • Comment strictness: Enforces lowercase function calls, forbids # comments, disallows empty/@author tags, and restricts comment word usage (@var allowed only for properties). Be prepared for noisy false positives in legacy docblocks.
  • Auto-fix limitations: phpcbf won’t fix all issues (e.g., logical problems like global usage or type safety). Always review changes and commit frequently.
  • Rule overrides: To disable a problematic sniff, add <rule ref="SniffName"/> with severity="0" or exclude specific codes via <exclude name="ZendFramework.Standard sniff_code"/>.
  • Migration path: To upgrade, replace the dependency with laminas/laminas-coding-standard, update your phpcs.xml path, and run tests — minor rule differences may require调整.
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
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
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation