$validator->add_rules([ 'age' => 'required|min_age:18' ]); // Custom rule implementation $validator->extend('min_age', function($attribute, $value, $parameters) { $minAge = (int) $parameters[0]; $birthday = new DateTime($value); $diff = $birthday->diff(new DateTime); return $diff->y >= $minAge; });In this example, we are adding a custom validation rule to enforce a minimum age requirement of 18 years. Package Library: This code example uses Laravel Validation, a popular PHP validation library.