A declarative validator
Validate's validators are easy to use and to extend.
They are all available as static functions under Validate\V
, so they can be easily found.
use Validate\V;
V::and(V::string(), V::minLength(5))('Hello'); // true
use Validate\V;
$notNull = static fn ($input): bool => $input !== null; // Equivalent to `V::not(V::null))`
$notNull(null); // false
V::not($notNull)(null); // true because it is not not null
Feel free to add some common validation rules
I wanted to create a declarative validation library, so I looked around to see what did exist, so I came across v8n.