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

Php Code Validator Laravel Package

flyeralarm/php-code-validator

FLYERALARM PHP coding guideline validator: a PSR-12 based PHP_CodeSniffer ruleset with extra standards like lowerCamelCase variables, no Yoda conditions, bans on eval/goto, namespace underscores, and certain class suffixes. Easy Composer embed via ruleset.xml.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Standardization Across Teams: Enforce a consistent PHP coding style (PSR-12 + custom rules) across Laravel projects, reducing technical debt and improving collaboration.
  • Developer Experience (DX) Improvement: Automate repetitive style checks (e.g., lowerCamelCase, Yoda conditions) to reduce cognitive load during code reviews and PRs.
  • CI/CD Pipeline Enhancement: Integrate automated code validation into GitHub Actions/GitLab CI, catching violations early and shifting left on quality.
  • Onboarding Acceleration: Provide a pre-configured ruleset for new hires, ensuring they adhere to best practices from day one without manual guidance.
  • Leverage Open-Source Ecosystem: Avoid reinventing a custom validator by extending an existing, battle-tested package (PHP_CodeSniffer) with minimal maintenance overhead.
  • Use Cases:
    • New Laravel Projects: Enforce standards from the outset.
    • Legacy Codebases: Gradually standardize existing code via sniff-fix.
    • Multi-Team Collaboration: Align disparate teams on a single coding style.
    • Compliance/Regulated Environments: Ensure auditability via strict, documented rules.

When to Consider This Package

  • Adopt if:

    • Your team already uses PSR-12 or is willing to adopt it as a foundation.
    • You need custom Laravel/PHP-specific rules (e.g., exception message formatting, namespace conventions) beyond PSR-12.
    • You want to reduce manual code review effort by automating style checks in CI/CD.
    • Your project prioritizes consistency over flexibility (e.g., internal tools, startups, or regulated industries).
    • You’re using PHP_CodeSniffer or PHP-CS-Fixer and want a pre-configured ruleset to avoid maintenance overhead.
    • Your team is open to opinionated tooling (e.g., no Yoda conditions, strict naming conventions).
  • Look Elsewhere if:

    • Your team rejects strict conventions (e.g., prefers team-specific style guides or ad-hoc rules).
    • You need highly customizable rules (e.g., per-project exceptions, dynamic rule sets) that this package doesn’t support.
    • Your stack doesn’t use PHP_CodeSniffer (e.g., heavy reliance on ESLint, RuboCop, or other tools).
    • You require real-time IDE feedback without CLI integration (though PHPStorm support is provided).
    • Your Laravel project heavily deviates from PSR-12 (e.g., custom naming conventions for Eloquent models/repositories).
    • You need performance-critical validation (PHP_CodeSniffer can be slow for large codebases; consider caching or parallelization).

How to Pitch It (Stakeholders)

For Executives: "This package lets us automate and enforce PHP coding standards across our Laravel projects, reducing bugs, onboarding time, and manual review effort. By integrating it into our CI pipeline, we’ll catch style violations early—saving engineering time and improving code quality. It’s a low-maintenance, high-impact solution that aligns with industry best practices (PSR-12) while adding our custom rules. Think of it as Prettier for PHP: no more debates over formatting, just consistent, high-quality code."

For Engineering Leaders: *"We’re adopting a pre-configured PHP_CodeSniffer ruleset that enforces PSR-12 plus FLYERALARM-specific conventions (e.g., lowerCamelCase variables, no Yoda conditions). This will:

  • Reduce PR review time by automating style checks.
  • Improve onboarding with clear, documented standards.
  • Integrate seamlessly with our Laravel projects via Composer and Makefile commands.
  • Support multi-PHP-version testing via Docker, ensuring compatibility with Laravel’s LTS and newer versions. The sniff and sniff-fix commands will auto-correct most issues, and we can fail builds in CI/CD for violations. This shifts repetitive work to the tool, letting us focus on architecture and business logic."*

For Developers: *"This is like PHP’s ESLint + Prettier combo—but for our team’s exact standards. Here’s how it helps you:

  • No more style debates: The tool enforces rules like:
    • use_underscores_in_namespaces
    • yoda_conditions (e.g., if (1 === $x))
    • ✅ Auto-fixable lowerCamelCase variables.
  • Works with your workflow:
    • Run make sniff before commits to catch issues early.
    • Use make sniff-fix to auto-correct safe violations.
    • Integrate with PHPStorm for real-time feedback.
  • Laravel-friendly: Built on PSR-12, so it plays nice with Laravel’s conventions (but we can override rules if needed).
  • Zero setup: Just add it as a dev dependency and update your Makefile. No need to write custom rules unless you want to extend it."*

For Technical Architects: *"This package provides a scalable, maintainable way to enforce coding standards in Laravel projects. Key advantages:

  • Extensible: Built on PHP_CodeSniffer, so we can add custom rules (e.g., Laravel-specific checks) without reinventing the wheel.
  • CI/CD Ready: Dockerized testing supports PHP 8.2–8.5, aligning with Laravel’s LTS and newer versions.
  • Performance Considerations: While PHP_CodeSniffer can be slow, we can mitigate this with:
    • Caching (e.g., --cache flag).
    • Parallel execution in CI.
    • Excluding test files or large directories from strict checks.
  • Future-Proof: If Laravel’s standards evolve (e.g., new PSR proposals), we can update the ruleset incrementally. Potential Challenges:
  • Some Laravel conventions (e.g., UserRepositoryInterface) may conflict with custom rules (e.g., no Interface suffix). We’ll need a strategy to override or exclude these cases.
  • Large codebases may require incremental adoption (e.g., start with new files, then retroactively fix legacy code)."*
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
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
christhompsontldr/laravel-inky