Skip to main content

UUIDv7

UUIDv7 is a time-ordered UUID based on Unix timestamp milliseconds, designed for modern applications where both performance and global uniqueness matter.

It offers:

  • Sortable by generation time
  • High entropy for uniqueness
  • Simpler structure than v1 or v6

Generate a UUIDv7

use DomainFlow\Uuid\UuidV7;

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

Validate a UUIDv7

UuidV7::isValid('01890b5a-69cd-7def-bb12-9c6f0c6aa3f3');

Inspector Output

use DomainFlow\Uuid\Inspector;

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

Returns:

[
'unix_timestamp_ms' => 1712150400000,
'sortable' => true
]

Use Cases

  • Event logs, time-series data, and analytics
  • Distributed systems needing both order and randomness
  • Better choice over UUIDv1/v6 when working with modern databases

Pro tip: UUIDv7 is shaping up to be a strong default for systems that care about timestamp sortability + random uniqueness — all while avoiding MAC address exposure or v1’s legacy quirks.