sandermuller/laravel-fluent-validation
Type-safe, IDE-autocomplete Laravel validation rule builders. Create rules fluently without memorizing strings; each rule exposes only valid methods. Define nested array validation with each()/children(). Optional HasFluentRules trait speeds wildcard validation dramatically (up to 160x).
Illuminate\Validation\Validator), ensuring backward compatibility and minimal disruption to existing workflows.FluentRule factory and rule-specific builders (e.g., FluentRule::string(), FluentRule::array()) enforce type safety and reduce cognitive load.HasFluentRules trait provides a performance boost for large datasets without sacrificing readability.required, unique, exists) plus additional features like each()/children() for nested arrays, when()/unless() for conditionals, and custom error messages. The rule reference ensures parity with Laravel’s native API.Rule::when()), nested arrays, or custom validation logic that might not translate cleanly to the fluent API?FluentRule factory alongside native Laravel rules to validate the approach.composer require sandermuller/laravel-fluent-validation.composer.json to include the Rector package for migration.FluentRule and validate behavior against the original.vendor/bin/rector process src --dry-run.HasFluentRules for performance-critical endpoints (e.g., bulk imports).FluentRulesTester for Pest).'required|string|min:2') and co-locate related rules (e.g., each() for nested arrays), reducing maintenance overhead.rules() and messages() arrays.FluentRulesTester simplifies writing validation tests.HasFluentRules trait provides significant speedups for large datasets (e.g., 160x faster wildcard validation). Benchmark critical paths post-migration to validate improvements.exists/unique checks reduce database load for bulk operations. Ensure database connections are properly configured to handle batched queries.How can I help you explore Laravel packages today?