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

Laravel Ruleset Validation Laravel Package

craftcms/laravel-ruleset-validation

Validate Laravel request data against Craft CMS field rulesets. Map Craft-style constraints (required, min/max, regex, etc.) into Laravel’s validator, keeping validation logic consistent between Craft and Laravel apps.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Modular Architecture: Enables domain-driven validation by encapsulating rules within reusable Ruleset classes, aligning with clean architecture principles. Reduces controller bloat and improves separation of concerns.
  • API/Backend Consistency: Standardizes validation logic between frontend (Inertia/Vue) and backend, ensuring API contracts match UI expectations. Critical for projects using Laravel as a backend for SPAs or mobile apps.
  • Dynamic Workflows: Supports context-aware validation (e.g., admin vs. user flows, draft vs. published content) via scenarios, reducing conditional logic in controllers.
  • Legacy Refactoring: Justifies gradual migration from monolithic FormRequest classes to modular rulesets, improving testability and maintainability.
  • Compliance/Regulatory Features: Simplifies implementation of complex validation rules (e.g., GDPR data processing, financial transaction rules) by centralizing logic in rulesets.
  • Team Scalability: Reduces onboarding friction for new developers by documenting validation rules in reusable components rather than scattered across controllers.

When to Consider This Package

  • Adopt when:
    • Your project has >5 FormRequest classes with overlapping or nested validation logic.
    • You’re building multi-step forms (e.g., checkout, multi-page wizards) where validation rules change per step.
    • Your team uses DTOs or domain objects that need validation before processing (e.g., CreateOrder, UpdateUserProfile).
    • You need conditional validation (e.g., "validate ssn only if is_us_customer is true").
    • You’re integrating third-party APIs that require validation of their responses (e.g., payment gateways, CRM webhooks).
    • Your validation rules depend on runtime data (e.g., user roles, database records, external services).
    • You’re migrating from custom validation libraries to Laravel’s ecosystem and want to leverage FormRequest compatibility.
  • Look elsewhere if:
    • Your validation needs are trivial (e.g., basic CRUD forms with required|string).
    • You’re using a dedicated validation framework (e.g., Spatie’s Laravel Validation, Symfony Validator) that already meets your needs.
    • Your team lacks Laravel/PHP expertise to maintain custom rulesets or debug validation failures.
    • You’re optimizing for raw performance (e.g., high-frequency APIs) and need to benchmark overhead (though the package is lightweight).
    • Your project uses a non-Laravel framework (e.g., Symfony, Django, Node.js).
    • You prioritize minimal dependencies and this package adds complexity without clear ROI.

How to Pitch It (Stakeholders)

For Executives/Stakeholders: *"This package lets us write validation rules once and reuse them everywhere—like a ‘validation Lego set’ for our app. For example:

  • Faster feature launches: Cut validation development time by 40% for complex flows (e.g., subscriptions, compliance forms).
  • Fewer bugs: Eliminate inconsistencies between frontend and backend validation by sharing rulesets across both.
  • Easier maintenance: Rules are centralized in reusable classes, so updates (e.g., new data formats) require changes in one place.
  • Scalable teams: New devs can onboard faster by learning a standardized approach to validation, rather than deciphering scattered FormRequest logic.
  • Future-proof: Works with Laravel’s built-in tools (e.g., API resources, Inertia.js) and won’t lock us into proprietary solutions.

Think of it as moving from ‘copy-pasting validation rules’ to ‘drag-and-drop reusable blocks.’ It’s a small investment now that pays off in cleaner code and faster iterations."

For Engineers/Architects: *"This package decouples validation logic from controllers by moving rules into reusable Ruleset classes. Key advantages:

  • Cleaner controllers: No more bloated FormRequest subclasses or manual validation in actions.
  • Testable rules: Isolate validation logic for unit testing (e.g., mock dependencies like User or Database).
  • Dynamic scenarios: Switch validation rules at runtime (e.g., draft vs. published modes) without conditional spaghetti.
  • Flexible input sources: Validate requests, DTOs, or domain objects with the same API.
  • Laravel-native: Works seamlessly with FormRequest features (e.g., authorize(), messages(), validated()) but adds:
    • Object-backed validation (no need for FormRequest subclasses for simple cases).
    • Scenario API (lightweight context switching).
    • Subset validation (e.g., ->only(['title', 'slug'])->validate()).

Example use case: Instead of writing 3 FormRequest classes for a multi-step form, define one CreateOrderRuleset with scenarios for each step. Reuse it in controllers, API endpoints, and even CLI commands.

Tradeoff: Slight learning curve for teams new to Laravel’s validation system, but the payoff is DRY, maintainable, and scalable validation logic.*"

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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle