Uuid
RamseyUuidUuid provides static methods for the most common functionality for generating and working with UUIDs. It also provides constants used throughout the ramsey/uuid library.
- class Ramsey\Uuid\Uuid
- constant UUID_TYPE_TIME
- constant UUID_TYPE_DCE_SECURITY
Version 2: DCE Security UUID.
- constant UUID_TYPE_HASH_MD5
- constant UUID_TYPE_RANDOM
Version 4: Random UUID.
- constant UUID_TYPE_HASH_SHA1
- constant UUID_TYPE_REORDERED_TIME
- constant UUID_TYPE_PEABODY
Deprecated. Use
Uuid::UUID_TYPE_REORDERED_TIME
instead.
- constant UUID_TYPE_UNIX_TIME
- constant NAMESPACE_DNS
The name string is a fully-qualified domain name.
- constant NAMESPACE_URL
The name string is a URL.
- constant NAMESPACE_OID
The name string is an ISO object identifier (OID).
- constant NIL
The nil UUID is a special form of UUID that is specified to have all 128 bits set to zero.
- constant DCE_DOMAIN_PERSON
DCE Security principal (person) domain.
- constant DCE_DOMAIN_GROUP
DCE Security group domain.
- constant DCE_DOMAIN_ORG
DCE Security organization domain.
- constant RESERVED_NCS
Variant identifier: reserved, NCS backward compatibility.
- constant RFC_4122
Variant identifier: the UUID layout specified in RFC 4122.
- constant RESERVED_MICROSOFT
Variant identifier: reserved, Microsoft Corporation backward compatibility.
- constant RESERVED_FUTURE
Variant identifier: reserved for future definition.
- static uuid1([$node[, $clockSeq]])
Generates a version 1, Gregorian time UUID. See Version 1: Gregorian Time.
- Parameters:
$node (
Ramsey\Uuid\Type\Hexadecimal|null
) – An optional hexadecimal node to use$clockSeq (
int|null
) – An optional clock sequence to use
- Returns:
A version 1 UUID
- Return type:
- static uuid2($localDomain[, $localIdentifier[, $node[, $clockSeq]]])
Generates a version 2, DCE Security UUID. See Version 2: DCE Security.
- Parameters:
$localDomain (
int
) – The local domain to use (one ofUuid::DCE_DOMAIN_PERSON
,Uuid::DCE_DOMAIN_GROUP
, orUuid::DCE_DOMAIN_ORG
)$localIdentifier (
Ramsey\Uuid\Type\Integer|null
) – A local identifier for the domain (defaults to system UID or GID for person or group)$node (
Ramsey\Uuid\Type\Hexadecimal|null
) – An optional hexadecimal node to use$clockSeq (
int|null
) – An optional clock sequence to use
- Returns:
A version 2 UUID
- Return type:
- static uuid3($ns, $name)
Generates a version 3, name-based (MD5) UUID. See Version 3: Name-based (MD5).
- Parameters:
$ns (
Ramsey\Uuid\UuidInterface|string
) – The namespace for this identifier$name (
string
) – The name from which to generate an identifier
- Returns:
A version 3 UUID
- Return type:
- static uuid4
Generates a version 4, random UUID. See Version 4: Random.
- Returns:
A version 4 UUID
- Return type:
- static uuid5($ns, $name)
Generates a version 5, name-based (SHA-1) UUID. See Version 5: Name-based (SHA-1).
- Parameters:
$ns (
Ramsey\Uuid\UuidInterface|string
) – The namespace for this identifier$name (
string
) – The name from which to generate an identifier
- Returns:
A version 5 UUID
- Return type:
- static uuid6([$node[, $clockSeq]])
Generates a version 6, reordered time UUID. See Version 6: Reordered Time.
- Parameters:
$node (
Ramsey\Uuid\Type\Hexadecimal|null
) – An optional hexadecimal node to use$clockSeq (
int|null
) – An optional clock sequence to use
- Returns:
A version 6 UUID
- Return type:
- static uuid7([$dateTime])
Generates a version 7, Unix Epoch time UUID. See Version 7: Unix Epoch Time.
- Parameters:
$dateTime (
DateTimeInterface|null
) – The date from which to create the UUID instance
- Returns:
A version 7 UUID
- Return type:
- static fromString($uuid)
Creates an instance of UuidInterface from the string standard representation.
- Parameters:
$uuid (
string
) – The string standard representation of a UUID
- Return type:
- static fromBytes($bytes)
Creates an instance of UuidInterface from a 16-byte string.
- Parameters:
$bytes (
string
) – A 16-byte binary string representation of a UUID
- Return type:
- static fromInteger($integer)
Creates an instance of UuidInterface from a 128-bit string integer.
- Parameters:
$integer (
string
) – A 128-bit string integer representation of a UUID
- Return type:
- static fromDateTime($dateTime[, $node[, $clockSeq]])
Creates a version 1 UUID instance from a DateTimeInterface instance.
- Parameters:
$dateTime (
DateTimeInterface
) – The date from which to create the UUID instance$node (
Ramsey\Uuid\Type\Hexadecimal|null
) – An optional hexadecimal node to use$clockSeq (
int|null
) – An optional clock sequence to use
- Returns:
A version 1 UUID
- Return type:
- static isValid($uuid)
Validates the string standard representation of a UUID.
- Parameters:
$uuid (
string
) – The string standard representation of a UUID
- Return type:
bool
- static setFactory($factory)
Sets the factory used to create UUIDs.
- Parameters:
$factory (
Ramsey\Uuid\UuidFactoryInterface
) – A UUID factory to use for all UUID generation
- Return type:
void