Leaf's form validation functionality packaged as a serve-yourself module.
You can easily install Leaf using the Leaf CLI:
leaf install form
Or via Composer.
composer require leafs/form
<?php
$data = [
'name' => [
'first' => 'Jane',
'last' => 'Doe',
],
'email' => 'example@example.com',
'password' => 'password1234',
];
$validated = form()->validate($data, [
'name' => 'array()',
'name.first' => 'required',
'name.last' => 'required',
'email' => 'required|email',
'password' => 'required|min:8'
]);
if ($validated) {
// do something
} else {
// get errors
$errors = form()->errors();
}