UUID Validator

Zend\Validator\Uuid allows validating Universally Unique IDentifiers (UUIDs). UUIDs are 128-bit values that are guaranteed to be "practically unique" in order to help prevent identifier conflicts. Five separate UUID versions exist:

The Uuid validator is capable of validating whether a string is a valid UUID of any version. It does not validate that the UUID exists in your system, however, only that it is well-formed.

Introduced in 2.8.0

Zend\Validator\Uuid was introduced with version 2.8.0.

Supported options

The Uuid validator has no additional options.

Basic usage

$validator = new Zend\Validator\Uuid();

if ($validator->isValid($uuid)) {
    // UUID was valid
} else {
    // Invalid/mal-formed UUID; use $validator->getMessages() for more detail