Skip to main content

UUIDv1

UUIDv1 is a time-based UUID that includes:

  • A 60-bit timestamp (in 100-nanosecond intervals since 1582-10-15)
  • A 14-bit clock sequence
  • A 48-bit node identifier (typically a MAC address or random bytes)

This format ensures temporal uniqueness and is ideal when you need UUIDs that reflect creation order.

Generate a UUIDv1​

use DomainFlow\Uuid\UuidV1;

$uuid = UuidV1::generate();
echo (string) $uuid;

Validate a UUIDv1​

$isValid = UuidV1::isValid('f47ac10b-58cc-11ec-8f4c-0242ac120002');

Metadata with Inspector​

You can extract structured data from a UUIDv1 using the Inspector class:

use DomainFlow\Uuid\Inspector;

$inspector = Inspector::analyze((string) $uuid);
$metadata = $inspector->metadata();

print_r($metadata);

Typical metadata returned:

[
'timestamp_100ns' => 139856337381430000,
'clock_sequence' => 10524,
'node' => '02:42:AC:12:00:02'
]

Use Cases​

  • Events that must be sorted chronologically
  • Systems that require unique IDs across machines
  • Avoiding collisions without central coordination

Node Generation​

This package does not read the machine's MAC address. The node identifier is always generated from random bytes, with the multicast bit set per RFC 4122 §4.5 — this marks the node as randomly generated rather than a real hardware address, and avoids any risk of colliding with an actual MAC.

See Also​

Every UUID class shares the same comparison and serialization methods — see Shared Methods for fromString(), equals(), jsonSerialize(), and fromJson().


⚠️ Note: Since UUIDv1 embeds a timestamp, it can reveal creation order and approximate creation time. If privacy is a concern, consider using UuidV4 or UuidV6.