mini\uuid4() Function

Documentation

Generate a UUID v4 (cryptographically random).

UUID v4 provides 122 bits of cryptographic randomness with no temporal component. Use when you need maximum unpredictability or want to avoid timestamp leakage.

Example Usage

$token = uuid4();  // "550e8400-e29b-41d4-a716-446655440000"

Common Use Cases

  • API tokens and session identifiers
  • Password reset tokens
  • Shareable links (prevents enumeration)
  • Privacy-sensitive identifiers

Signature

function uuid4(): string

Returns

string

Source

src/UUID/functions.php:63-65