- How do I install juststeveking/fluent-validation in a Laravel app?
- Install it with composer require juststeveking/fluent-validation. The package needs no config publishing and normally no service provider, so setup is limited to Composer. Confirm the resolved version against your Laravel and PHP constraints before merging.
- Which Laravel and PHP versions does fluent-validation support?
- The last release was 2022-11-10, which targets the Laravel 9 and PHP 8.1 era. Treat the composer.json constraints as the starting point, then prove Laravel 10, 11, or 12 and PHP 8.2+ on a spike branch. Do not assume compatibility for production standardization.
- Does fluent-validation replace Laravel's native validation rules?
- It is an authoring helper, not a new validation engine; native Laravel rules remain the behavioral source of truth. On a spike, confirm whether the chainable builder compiles to native strings, arrays, or Rule objects. Use it only where the output is native-equivalent and auditable.
- Is fluent-validation maintained and safe for production?
- The package has a single maintainer, roughly 26 stars, zero dependents, and no release in about three years. That means no ecosystem canary if a new Laravel major breaks it. It is MIT, so a fork or vendor fallback exists, but that turns external risk into internal maintenance ownership.
- How do I use fluent-validation inside a FormRequest?
- Build the chainable rule set inside your FormRequest rules() method and return it as the method expects. Normalize the returned shape once at the FormRequest boundary rather than scattering conversions. Add a regression test that asserts the final rules() output so drift is caught in CI.
- Can fluent-validation handle custom Rule objects, nested arrays, sometimes, required_if, and Password::defaults()?
- The README is thin and the package is described as sensible defaults, stopping short of the advanced surface. Custom Rule objects, nested arrays, sometimes, required_if, localization, and Password::defaults() parity must be verified against the test suite. Where those are required, keep explicit native Laravel rules.
- Does fluent-validation work with Laravel 10, 11, or 12 and PHP 8.2+?
- Compatibility with Laravel 10, 11, or 12 and PHP 8.2+ is not proven by the release history. The last release is from the Laravel 9 era with a single maintainer and no dependents. Run a spike branch against your target versions before adopting it anywhere shared.
- What shape does rules() return in fluent-validation, and is it serializable?
- The return shape is the key integration question: rules() may produce strings, arrays, or arrays of objects for different rule types. That shape can leak into serialization, OpenAPI schemas, logging, and error responses. Normalize it at the FormRequest boundary and pick one representation for the codebase.
- How should I test fluent-validation rule output in CI?
- Write before-and-after regression tests that assert on the rules() output rather than only on HTTP responses. The test suite is the de facto specification because the README is thin. These assertions catch silent behavior drift from sensible defaults before it becomes a 422 ticket.
- What are the alternatives to fluent-validation for fluent Laravel validation?
- Native Laravel string rules, Rule objects, Password::defaults(), FormRequests, and custom Rule classes cover the same ground with full framework support. A thin in-house helper or facade that returns toArray() is the lowest-risk fluent alternative. Choose it if you need the pattern without an unmaintained dependency.