class UUID

Class that generates and validates UUIDs.

Constants

DNS

DNS namespace.

URL

URL namespace.

OID

ISO OID namespace.

X500

X.500 DN namespace.

NIL

The "nil" UUID.

Methods

static bool
validate(string $uuid)

Checks if a UUID is valid.

static string
toBinary(string $uuid)

Converts a UUID from its hexadecimal representation to a binary string.

static string
toHexadecimal(string $bytes)

Converts a binary UUID to its hexadecimal representation.

static string
v3(string $namespace, string $name)

Returns a V3 UUID.

static string
v4()

Returns a V4 UUID.

static string
v5(string $namespace, string $name)

Returns a V5 UUID.

static string
sequential()

Returns a sequential (COMB) v4 UUID.

Details

at line 81
static bool validate(string $uuid)

Checks if a UUID is valid.

Parameters

string $uuid The UUID to validate

Return Value

bool

at line 95
static string toBinary(string $uuid)

Converts a UUID from its hexadecimal representation to a binary string.

Parameters

string $uuid UUID

Return Value

string

Exceptions

InvalidArgumentException

at line 120
static string toHexadecimal(string $bytes)

Converts a binary UUID to its hexadecimal representation.

Parameters

string $bytes Binary representation of a UUID

Return Value

string

at line 137
static string v3(string $namespace, string $name)

Returns a V3 UUID.

Parameters

string $namespace Namespace
string $name Name

Return Value

string

at line 157
static string v4()

Returns a V4 UUID.

Return Value

string

at line 175
static string v5(string $namespace, string $name)

Returns a V5 UUID.

Parameters

string $namespace Namespace
string $name Name

Return Value

string

at line 195
static string sequential()

Returns a sequential (COMB) v4 UUID.

Return Value

string