laminas/laminas-validator
Validation component for PHP and Laminas applications. Provides a wide range of ready-to-use validators (strings, numbers, dates, files, and more), consistent error messages, and an extensible API to create custom validators and input filtering rules.
Laminas\Validator\Hex allows you to validate if a given value contains only
hexadecimal characters. These are all characters from 0 to 9 and A to F,
case insensitive. There is no length limitation for the input you want to
validate.
$validator = new Laminas\Validator\Hex();
if ($validator->isValid('123ABC')) {
// value contains only hex chars
} else {
// false
}
Invalid Characters
All other characters will return false, including whitespace and decimal points. Additionally, unicode zeros and numbers from other scripts than latin will not be treated as valid.
There are no additional options for Laminas\Validator\Hex.
How can I help you explore Laravel packages today?