UUIDv6
UUIDv6 is a proposed standard that reorders UUIDv1's timestamp bits to make the UUID sortable by creation time.
This format keeps the time, clock sequence, and node structure, but rearranges them for better performance in databases and logs.
Generate a UUIDv6
use DomainFlow\Uuid\UuidV6;
$uuid = UuidV6::generate();
echo (string) $uuid;
Validate a UUIDv6
UuidV6::isValid('1e461b98-77e3-6f23-a2c7-f0c3bdf4a2e6');
Inspector Output
use DomainFlow\Uuid\Inspector;
$metadata = Inspector::analyze((string) $uuid)->metadata();
Returns:
[
'timestamp_100ns' => 139856337381430000,
'sortable' => true
]
Use Cases
- Time-ordered primary keys in relational databases
- Systems that require both UUID uniqueness and temporal sorting
- Ideal for log entries, event streams, and audit trails
Node Generation
Like UuidV1, the node identifier is generated from random bytes with the multicast bit set per RFC 4122 §4.5, so it's never mistaken for a real MAC address.
See Also
Every UUID class shares the same comparison and serialization methods — see Shared Methods for fromString(), equals(), jsonSerialize(), and fromJson().
📌 Note: UUIDv6 is not yet an official RFC, but it's widely adopted in distributed systems that want timestamp sortability without relying on database sequences.