Skip to content

Validator

Rfc4122\Validator validates strings as UUIDs of the RFC 4122 variant

Constants

Constant Visibility Type Value
VALID_PATTERN private '\A[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-' . '[1-8][0-9A-Fa-f]{3}-[ABab89][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}\z'

Methods

getPattern

Returns the regular expression pattern used by this validator

public getPattern(): string

Return Value:

The regular expression pattern this validator uses


validate

Returns true if the provided string represents a UUID

public validate(string $uuid): bool

Parameters:

Parameter Type Description
$uuid string The string to validate as a UUID

Return Value:

True if the string is a valid UUID, false otherwise



Automatically generated on 2025-03-18