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

Standards Laravel Package

graze/standards

Graze Coding Standards: a cross-language style guide for the Graze tech team. Covers general formatting rules, Git conventions, and standards for PHP, HTML, JavaScript, Python, SQL, CSS/Less, Markdown, and Go, plus open source and environment guidance.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Pros:

    • Laravel-native compatibility: The package is designed for PHP (with Laravel-specific sniffs) and integrates seamlessly with PHP_CodeSniffer (PHPCS), a tool already widely used in Laravel ecosystems (e.g., via php-cs-fixer or laravel-pint).
    • Standardization: Aligns with Graze’s RFC 2119-compliant rules, which can enforce consistency across teams, reducing cognitive load during code reviews.
    • Extensible: Supports custom sniffs (e.g., Graze.ControlStructures.NegationNoSpaces) and can be layered with existing PHPCS rulesets (e.g., PSR-12, Laravel-specific rules).
    • Multi-language: While PHP-focused, the package’s broader standards (Git, Docker, AWS) can unify tooling across a polyglot stack (e.g., Laravel + JavaScript/TypeScript).
  • Cons:

    • Overhead for small teams: Strict adherence may slow down development if the team lacks PHPCS familiarity or prefers minimalist tooling (e.g., pint for Laravel).
    • False positives: Custom sniffs (e.g., abstract class naming) might conflict with legacy code or third-party libraries, requiring frequent exceptions.
    • PHPCS dependency: Requires PHPCS v3.x+, which may necessitate infrastructure updates (e.g., CI/CD pipelines, local dev environments).

Integration Feasibility

  • PHPCS Integration:

    • Easy: Add to composer.json as a dev dependency and configure PHPCS to use the Graze ruleset:
      "require-dev": {
        "graze/standards": "^2.0"
      }
      
    • Ruleset Setup: Create a .phpcs.xml file to include Graze sniffs alongside PSR-12:
      <config defaultStandard="PSR12">
        <arg name="extensions" value="php"/>
        <arg name="tab-width" value="4"/>
        <arg name="standard" value="Graze"/>
      </config>
      
    • CI/CD: Integrate PHPCS into Git hooks (e.g., pre-commit) or CI (e.g., GitHub Actions) to block violations.
  • Tooling Conflicts:

    • With pint/php-cs-fixer: Graze’s PHPCS rules may overlap with auto-fix tools. Prioritize PHPCS for enforcement and use pint for Laravel-specific formatting (e.g., pint --preset=laravel).
    • With IDEs: Ensure IDEs (PHPStorm, VSCode) are configured to use the Graze ruleset for real-time feedback.

Technical Risk

  • High:
    • PHPCS Version Lock: Requires PHPCS 3.x+, which may break existing setups using older versions (e.g., PHPCS 2.x).
    • Custom Sniff Complexity: Sniffs like AbstractClassNaming or NegationNoSpaces may generate noisy warnings in legacy codebases, requiring manual triage.
    • Performance: PHPCS can slow down CI pipelines if not cached (e.g., using phpcs --cache or php-parallel-lint).
  • Mitigation:
    • Pilot Phase: Test in a non-production branch with a subset of sniffs enabled.
    • Gradual Rollout: Start with non-breaking rules (e.g., indentation, line endings) before enforcing stricter sniffs.
    • Exception Framework: Document how to justify violations (e.g., via PR comments or a // @codingStandardsIgnore annotation).

Key Questions

  1. Team Readiness:
    • Does the team have experience with PHPCS, or will this require training?
    • Are developers open to strict RFC 2119-style enforcement, or will exceptions be common?
  2. Tooling Stack:
    • How will Graze standards coexist with existing tools (e.g., pint, ESLint, Prettier)?
    • Will the team adopt make docs-test for local documentation previews?
  3. Legacy Code:
    • What percentage of the codebase would violate Graze standards, and what’s the effort to remediate?
    • Are there third-party dependencies that cannot comply (e.g., vendor libraries)?
  4. CI/CD Impact:
    • How will PHPCS be integrated into the pipeline (e.g., fail-on-warning vs. allow-list)?
    • What’s the acceptable timeout for PHPCS in CI?
  5. Long-Term Maintenance:
    • Who will update the Graze ruleset if new sniffs are needed?
    • How will the team handle Graze’s future updates (e.g., breaking changes in PHPCS)?

Integration Approach

Stack Fit

  • Primary Fit:
    • Laravel PHP: Ideal for enforcing Graze’s PHP-specific sniffs (e.g., abstract class naming, negation spaces) and general formatting rules.
    • Polyglot Stacks: Useful for unifying standards across Laravel + JavaScript/TypeScript (via Graze’s JS/HTML/CSS rules) or Python/SQL.
  • Secondary Fit:
    • Non-Laravel PHP: Can be adopted by any PHP project, but lacks Laravel-specific sniffs (e.g., for Facades, Blade templates).
    • Non-PHP: The Git/AWS/Docker rules are valuable for any team, but require manual enforcement outside PHPCS.

Migration Path

  1. Assessment Phase:
    • Audit the codebase for violations using PHPCS with Graze sniffs (run locally first).
    • Identify high-effort areas (e.g., legacy abstract classes, negation patterns) vs. low-hanging fruit (e.g., line endings).
  2. Tooling Setup:
    • Add graze/standards to composer.json and configure PHPCS.
    • Integrate PHPCS into:
      • Local dev (e.g., VSCode extension, phpcs CLI).
      • Git hooks (e.g., pre-commit to block violations).
      • CI pipeline (e.g., GitHub Actions with fail_on_warning: true).
  3. Pilot Phase:
    • Enable Graze sniffs in a feature branch or new module.
    • Train the team on PHPCS usage and exception processes.
  4. Gradual Rollout:
    • Start with non-breaking rules (e.g., indentation, line endings).
    • Introduce stricter sniffs (e.g., negation spaces) after 2–4 weeks.
    • Phase out conflicting tools (e.g., replace php-cs-fixer with PHPCS for Graze-compliant rules).

Compatibility

  • PHPCS 3.x+: Required for Graze v2.x. If using PHPCS 2.x, upgrade or use a fork.
  • Laravel-Specific:
    • No native Laravel sniffs, but can extend PHPCS with custom rules (e.g., for Blade templates).
    • Conflicts with laravel-pint or pint: Decide whether to use PHPCS for enforcement or pint for auto-fixing.
  • IDE Support:
    • PHPStorm: Configure PHPCS as an inspector.
    • VSCode: Use the "PHP Intelephense" extension with PHPCS integration.
  • CI/CD:
    • GitHub Actions: Use squizlabs/php_codesniffer action.
    • GitLab CI: Cache PHPCS results to improve speed.

Sequencing

  1. Week 1–2: Setup and audit.
    • Install PHPCS and Graze standards.
    • Run PHPCS on the entire codebase to identify violations.
  2. Week 3–4: Pilot in a non-critical branch.
    • Enable Graze sniffs for new code only.
    • Document exception processes.
  3. Week 5–6: Gradual enforcement.
    • Enable sniffs for existing code in phases (e.g., by module).
    • Retire conflicting tools (e.g., php-cs-fixer).
  4. Ongoing: Maintenance.
    • Update PHPCS/Graze standards annually.
    • Review and update custom sniffs as needed.

Operational Impact

Maintenance

  • Pros:
    • Reduced Cognitive Load: Consistent standards simplify onboarding and code reviews.
    • Automated Enforcement: PHPCS catches issues early (pre-commit, CI).
    • Documentation: Graze’s MkDocs site provides a single source of truth for standards.
  • Cons:
    • PHPCS Updates: Requires monitoring for PHPCS/Graze updates (e.g., breaking changes in v3.x).
    • Sniff Maintenance: Custom sniffs may need updates if Graze adds/removes rules.
    • Exception Management: Tracking justified violations (e.g., in PRs or a ticketing system) adds overhead.

Support

  • Developer Experience:
    • Positive: Real-time feedback in IDEs and pre-commit blocks reduce merge conflicts.
    • Negative:
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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity