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

Larastan Strict Rules Laravel Package

canvural/larastan-strict-rules

Extra strict, opinionated PHPStan rules for Laravel via Larastan. Enforce safer patterns by banning dynamic where methods, facades, and global helpers; prevent validation in controllers; ensure scopes return Eloquent Builder. Enable all at once or toggle rules individually.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Enforcing Code Quality & Consistency: Adopting this package aligns with a strict coding standards initiative, reducing technical debt by enforcing Laravel best practices (e.g., avoiding facades, dynamic queries, or validation in controllers). This supports a long-term roadmap for maintainability and scalability.
  • Build vs. Buy Decision: Instead of building custom PHPStan rules or relying on manual code reviews, this package provides pre-built, opinionated rules, reducing engineering effort while improving code quality.
  • Developer Experience (DX) & Onboarding: Enforces consistent patterns (e.g., void return types for listeners, proper query builder usage), accelerating onboarding for new developers by reducing ambiguity in Laravel conventions.
  • Security & Stability: Rules like NoFacadeRule and NoGlobalLaravelFunctionRule help mitigate hidden dependencies and runtime errors, aligning with security-focused roadmaps.
  • Performance Optimization: Rules like ScopeShouldReturnQueryBuilderRule ensure efficient query building, supporting performance-focused initiatives.

When to Consider This Package

  • Adopt if:

    • Your team prioritizes strict Laravel conventions and wants to reduce anti-patterns (e.g., facades, dynamic queries).
    • You’re using PHPStan and Larastan for static analysis and want Laravel-specific enforcement.
    • Your codebase is growing in complexity, and you need automated guardrails to prevent technical debt.
    • You’re onboarding new developers and want to enforce consistent coding standards upfront.
    • Your CI/CD pipeline includes static analysis, and you want to fail fast on violations.
  • Look elsewhere if:

    • Your team values flexibility over strict opinions (e.g., facades are intentionally used for readability).
    • You’re using non-Laravel PHP or a custom framework where these rules don’t apply.
    • Your project is small-scale or prototyping, and strict rules would slow development.
    • You lack buy-in from developers for opinionated tooling (requires cultural alignment).
    • You’re already using alternative static analysis tools (e.g., Psalm, custom PHPStan rules) that conflict with these opinions.

How to Pitch It (Stakeholders)

For Executives:

"This package automates Laravel best practices enforcement via PHPStan, reducing bugs, improving code consistency, and accelerating onboarding. By adopting strict rules (e.g., no facades, no dynamic queries), we’ll cut technical debt, enhance security, and align with scalable architecture—all while requiring minimal upfront effort. It’s a low-cost, high-impact way to future-proof our codebase."

Key Outcomes: ✅ Faster onboarding (clearer conventions). ✅ Fewer production bugs (catches issues early). ✅ Lower maintenance costs (consistent patterns). ✅ Scalable architecture (avoids anti-patterns).


For Engineering Teams:

"This adds Laravel-specific PHPStan rules to catch anti-patterns like facades, dynamic queries, and validation in controllers—automatically. You can enable rules incrementally (e.g., start with NoFacadeRule), and it integrates seamlessly with your existing static analysis pipeline. It’s opinionated but configurable, so you’re not locked into every rule."

Why It Matters: 🔹 Reduces cognitive load: No more debating "should we use facades here?" 🔹 Catches edge cases: Finds bugs like return false in event listeners before they hit prod. 🔹 Future-proofs code: Enforces patterns that scale (e.g., proper query builder usage). 🔹 Low friction: Works with your existing PHPStan/Larastan setup—just include rules.neon.

Call to Action: "Let’s pilot this in the next sprint—start with 2–3 rules (e.g., NoFacadeRule + ListenerShouldHaveVoidReturnType) and measure the impact on code quality and developer velocity."

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
codifyo/ts-generator-bundle
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
spatie/mailcoach-vapor