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.
Ruleset classes, aligning with clean architecture principles. Reduces controller bloat and improves separation of concerns.FormRequest classes to modular rulesets, improving testability and maintainability.FormRequest classes with overlapping or nested validation logic.CreateOrder, UpdateUserProfile).ssn only if is_us_customer is true").FormRequest compatibility.required|string).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:
FormRequest logic.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:
FormRequest subclasses or manual validation in actions.User or Database).draft vs. published modes) without conditional spaghetti.FormRequest features (e.g., authorize(), messages(), validated()) but adds:
FormRequest subclasses for simple cases).->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.*"
How can I help you explore Laravel packages today?