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

Yoastcs Laravel Package

yoast/yoastcs

Yoast Coding Standards (YoastCS) provides Composer-installable rulesets and tooling for PHP code style and quality in Yoast projects, including PHP_CodeSniffer standards/sniffs and PHP Parallel Lint. Integrates via Composer for consistent CI enforcement.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Enforce WordPress/Laravel PHP Coding Standards: Adopt YoastCS to standardize code quality across Laravel-based WordPress plugins/themes, ensuring alignment with WordPress VIP standards and Yoast’s internal best practices.
  • Automate CI/CD Enforcement: Integrate YoastCS into CI pipelines (e.g., GitHub Actions, GitLab CI) to block merges with errors, reducing technical debt and improving maintainability.
  • Build vs. Buy: Avoid reinventing a custom PHPCS ruleset by leveraging YoastCS’s pre-configured, battle-tested sniffs (WordPressCS, Slevomat, PHPCompatibilityWP) tailored for WordPress/Laravel ecosystems.
  • Use Cases:
    • Plugin/Theme Development: Enforce consistent coding standards for Yoast’s internal Laravel-based WordPress products.
    • Open-Source Contributions: Standardize PR reviews for Laravel-WordPress projects (e.g., WooCommerce, Gravity Forms).
    • Legacy Code Modernization: Identify and fix deprecated PHP/WP patterns (e.g., get_option()get_site_option()) via PHPCompatibilityWP sniffs.
    • Onboarding: Accelerate developer ramp-up with automated linting and clear error messages (e.g., "Use null !== $var instead of isset($var)").

When to Consider This Package

  • Adopt YoastCS if:

    • Your Laravel project integrates with WordPress (plugins/themes) or targets WordPress environments.
    • You need strict PHP/WP compatibility checks (e.g., PHP 7.4+, WP 6.8+) without false positives.
    • Your team lacks dedicated linting expertise but wants pre-configured, enterprise-grade standards (Yoast’s internal rules + VIP standards).
    • You prioritize CI/CD automation to catch errors early (e.g., GitHub Actions workflows).
    • You’re using PHP_CodeSniffer and want to avoid maintaining custom rulesets.
  • Look Elsewhere if:

    • Your project is non-WordPress/Laravel (e.g., pure Symfony, generic PHP).
    • You need custom sniffs beyond Yoast’s curated set (e.g., domain-specific business logic rules).
    • Your team prefers alternative tools like PSR-12 (Symfony) or custom ESLint equivalents.
    • You’re constrained by legacy PHP versions (<7.2) or WordPress versions (<6.3), as YoastCS defaults to stricter minimums.

How to Pitch It (Stakeholders)

For Executives:

"YoastCS is a turnkey solution to elevate our Laravel-WordPress code quality—like a ‘WordPress VIP’ linting engine for our team. It automates compliance with WordPress’s official standards (and Yoast’s internal best practices), reducing bugs and onboarding time. By integrating this into CI, we’ll catch critical issues early, just like top-tier WordPress plugins do. Think of it as ‘GitHub Actions for code hygiene’—no more manual reviews for basic standards."

Key Outcomes:

  • Faster Releases: Block broken code pre-merge (e.g., PHP syntax errors, deprecated WP functions).
  • Consistency: Standardize across teams/projects (e.g., Yoast plugins, custom Laravel-WP integrations).
  • Cost Savings: Avoid reinventing linting wheels; leverage Yoast’s 10+ years of WordPress coding expertise.

For Engineering:

*"YoastCS gives us PHP_CodeSniffer on steroids for WordPress/Laravel:

  • Pre-configured sniffs: WordPressCS (official WP standards), Slevomat (modern PHP best practices), PHPCompatibilityWP (no false positives for WP polyfills), and Yoast’s custom rules.
  • CI-ready: Threshold reports (YOASTCS_THRESHOLD_ERRORS) let us enforce ‘zero errors’ in PRs or allow controlled warnings.
  • Parallel Linting: Fast static analysis with php-parallel-lint to catch syntax errors in seconds.
  • IDE Support: Works seamlessly with PhpStorm (select ‘Yoast’ standard in settings).

Example Workflow:

  1. Add to composer.json:
    "require-dev": {
      "yoast/yoastcs": "^3.0"
    }
    
  2. Run in CI:
    composer check-cs-warnings  # Fails on errors
    composer check-cs-thresholds # Enforces error/warning limits
    
  3. Fix issues flagged by PHPCS (e.g., ‘Use === for strict comparison’) or PHP Parallel Lint (e.g., missing semicolons).

Why Not Custom Rules?

  • YoastCS already handles edge cases (e.g., WordPress-specific sniffs like WordPress.WP.GetMetaSingle).
  • Updates are maintained by Yoast’s team (e.g., PHP 8.4 compatibility, WP 6.8+ support).
  • Saves ~20+ hours of setup time per project."*

For Developers: *"This is like ESLint for PHP—but for WordPress. It’ll:

  • Catch typos in get_post_meta() calls.
  • Warn you about using array_merge when ... (splat) would be cleaner.
  • Block deprecated functions like get_the_author() in favor of get_author_string().
  • Highlight inconsistent spacing in short arrays (e.g., [1,2,3] vs [ 1, 2, 3 ])."*
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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata