Skip to main content

UUIDv8

UUIDv8 is a custom, application-defined UUID. It’s reserved for use cases that don’t fit into any of the standard UUID formats (v1–v7).

It gives you full control over how the bits are structured, allowing you to encode things like:

  • Custom timestamps
  • Shard or region identifiers
  • App-specific metadata

Generate a UUIDv8

use DomainFlow\Uuid\UuidV8;

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

UUIDv8 is generated using random data, but you’re free to implement your own logic around it.

Validate a UUIDv8

UuidV8::isValid('01890b5a-69cd-8def-bb12-9c6f0c6aa3f3');

Inspector Output

use DomainFlow\Uuid\Inspector;

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

Yields a default fallback:

[
'info' => 'UUIDv8 is application-defined, structure unknown'
]

Use Cases

  • Custom formats or legacy UUID specs
  • Embedding app-specific metadata
  • Future-proofing with experimental UUID strategies