mini\UUID\UUID4Factory class

Documentation

Generates UUID v4 identifiers using cryptographically secure randomness.

UUID v4 is a 128-bit identifier formatted as a 36-character string: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx

Where:

  • x is any hexadecimal digit (0-9, a-f)
  • y is one of 8, 9, a, or b (representing the variant bits)
  • The 4 indicates UUID version 4

This implementation uses random_bytes() for cryptographic randomness and requires no configuration or machine identification.

Specification Details

Per RFC 4122:

  • Version field (4 bits): Set to 0100 (binary) = 4
  • Variant field (2 bits): Set to 10 (binary) = 8, 9, a, or b in hex
  • Remaining 122 bits: Cryptographically random

Example Output

550e8400-e29b-41d4-a716-446655440000

Inheritance

Implements: mini\UUID\FactoryInterface

Methods (1)

Generate a cryptographically secure UUID v4.

Source

src/UUID/UUID4Factory.php:32-49