Releases: kasapdev/php-request-validator
Releases · kasapdev/php-request-validator
Release list
v1.2.0
Added
- Wildcard array-of-objects validation: rule keys can now contain a single
*path segment, e.g.'items.*.price' => 'required|numeric', to validate a field across every element of a nested array of objects.- Each element is validated independently through the library's existing pipe-delimited rule parsing (
required,numeric,min, etc.) — unchanged. - Failures and passing values are reported under their concrete, expanded key (
items.0.price,items.1.price, ...) in the same flaterrors()/validated()structures used for ordinary fields, so no special-casing is needed on the caller's side. - An entirely absent parent array is treated as nothing-to-validate and passes, matching the library's existing optional-field-absent convention.
- A parent path that is present but not an array fails with a single error keyed on the base path, reusing the existing
arrayrule's type-mismatch message ("The items field must be an array."). - An empty parent array has no elements to iterate and passes.
- See the new "Validating Arrays of Objects" section in README.md for a full runnable example.
- Each element is validated independently through the library's existing pipe-delimited rule parsing (
- New tests in
tests/run.phpcovering: a mixed valid/invalid items array (asserting the exact failing index is reported and valid indices are absent from errors), a missing sub-field per element, an all-valid array, an absent parent, a non-array parent, and an empty parent array.
No breaking changes — all existing rule behavior is untouched; the refactor that extracted the shared per-field rule-application logic preserves identical behavior for every non-wildcard rule.
v1.1.0
Adds edge-case regression tests: in rule against array values/empty parameters, bare regex with no parameter, non-numeric min/max parameters, unrecognized rule names, colon-containing regex parameters, and whitespace tolerance in rule parsing. No behavioral changes; all tests pass.