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

Yii2 Coding Standards Laravel Package

yiisoft/yii2-coding-standards

The PHP_CodeSniffer coding standard used by Yii2 core and official extensions. Based on PSR-12 with documented Yii-specific exceptions, it lets you check and automatically fix PHP code with phpcs and phpcbf via the Yii2 ruleset. Requires PHP 7.4+ and PHP_CodeSniffer 4.0.2+.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Toolchain standardization / engineering hygiene roadmap item. This package is a PHP_CodeSniffer ruleset (PSR-12 base + Yii2-specific sniffs) plus a yii coding-style command. It supports a decision like "adopt one automated style gate across all PHP services" — but only if the decision includes Yii2 code, because the rules encode Yii2 conventions, not Laravel's.
  • Build vs. buy for linting rules. Choosing this over writing in-house PHPCS sniffs is a clear "buy" (adopt): zero cost, versioned releases, an upstream maintainer (Yii core team) that self-enforces the ruleset on the framework itself. Counter-candidate for a Laravel shop is laravel/pint (PHP-CS-Fixer based) or a thin custom phpcs.xml — this package does not replace either.
  • Legacy/migration program decisions. The one place it earns a slot in a Laravel org: a Yii2 → Laravel migration or a mixed monorepo. Here it supports "freeze legacy Yii2 code to its native style while new code follows Laravel/Pint," which reduces diff noise and reviewer load during the transition and prevents reformatting churn in files that are about to be deleted.
  • Scoping decision on static analysis vs. style. It clarifies an important portfolio boundary: this is style/format, not type or bug analysis. If the roadmap item is "reduce production defects," the correct purchase is PHPStan/Larastan, not this. Use this to keep the two initiatives from being conflated in planning.
  • Concrete use cases it enables: CI gate for a /legacy-yii/ directory only; editor/PhpStorm inspection profile for the handful of engineers still touching Yii2 services; contributor guidelines for any open-source Yii2 package the company maintains; a cheap pre-commit hook that ends style nitpicks in code review.
  • Do not use it to justify a company-wide "all PHP must pass Yii2 rules" mandate. That is a decision the package cannot support, and it will be read by Laravel engineers as an unexplained regression in their workflow.

When to Consider This Package

Adopt when:

  • You own or maintain Yii2 code — applications, a fork, or contributed packages — and want style checks that match how Yii core itself is written.
  • You are running a Yii2 → Laravel migration and want to keep legacy files consistent and reviewable without hand-formatting them, while new Laravel code uses Pint.
  • Your team already runs PHP_CodeSniffer 3.x in CI. This is a drop-in ruleset (--standard=Yii2), not a new tool; the only real setup cost is the dealerdirect/phpcodesniffer-composer-installer allow-plugin permission under Composer 2.2+.
  • You need a cheap, low-commitment pilot for "automate style enforcement" and want to measure reviewer time saved before investing in a broader standard.

Look elsewhere when:

  • The project is Laravel-only. Yii2 sniffs will flag Laravel idioms — facades, container-resolved $request, Blade files — as violations. Use Laravel Pint for formatting and Larastan/PHPStan for correctness. Layering this on top creates override debt with no payoff.
  • The goal is bug detection, type safety, or security review — different tool category entirely.
  • You need PSR-12 conformance only. Plain phpcs --standard=PSR12 does that; the Yii2 delta buys you nothing.
  • You cannot tolerate rule-maintenance overhead. Adoption means owning a phpcs.xml with explicit exclusions and documenting every override; that file becomes a small permanent artifact.
  • Adoption risk to flag: 180 stars, zero dependents, and a single-maintainer upstream. It is healthy enough (releases through 3.0.1, recent) but it is not a dependency to build a multi-team platform mandate on without a fallback — rulesets are easy to fork or vendor, so keep that option open and pin the version.

How to Pitch It (Stakeholders)

For executives (one paragraph): "This is a free, no-infrastructure way to automate PHP code-style checks for the Yii2 code we still own. It turns style disagreements into a machine check at pull-request time, which shortens reviews and makes the legacy codebase easier for new engineers to read while we migrate off it. It is not a quality or security tool and it changes nothing for our Laravel code, which keeps its existing formatter. Cost: zero licence, roughly a day of setup and a small config file to own. I am recommending it only for the Yii2 scope, not as a company-wide standard."

For engineering (the honest version): "It's a PHPCS ruleset — PSR-12 with Yii2's deltas — plus a yii coding-style command. Install as a dev dependency, point PHPCS at the Yii2 directories only (<exclude-pattern> everything Laravel), and run it in CI in warn mode first. Expect false positives on anything non-Yii2; don't fight them, scope them out. It complements, and does not replace, Pint or PHPStan — separate tool, separate job in the pipeline. If the deltas annoy us, forking the ruleset is a few files of XML; there is no lock-in."

Framing to avoid: don't present this as "a Laravel/PHP package we should adopt." It is a Yii2 artifact. The credible pitch is narrow — keep what we still run on Yii2 clean and reviewable, cheaply, while we leave Laravel's tooling alone. Anything broader will be correctly challenged in review.

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.
roundly-consulting/kubernetes-api-for-laravel
roundly-consulting/plausible-for-laravel
gvp/gvp-laravel-template
metasyncsite/laravel-metasync-client
roundly-consulting/onboarding-for-laravel
andydefer/laravel-notification
adachsoft/cli-process-tester
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo