UUIDv4
UUIDv4 is a random-based UUID — every UUID is generated using cryptographic randomness, making collisions statistically improbable.
It contains no embedded metadata and is ideal when uniqueness is the only concern.
Generate a UUIDv4
use DomainFlow\Uuid\UuidV4;
$uuid = UuidV4::generate();
echo (string) $uuid;
Validate a UUIDv4
UuidV4::isValid('f47ac10b-58cc-4372-a567-0e02b2c3d479');
Inspector Output
use DomainFlow\Uuid\Inspector;
$metadata = Inspector::analyze((string) $uuid)->metadata();
Returns:
[
'entropy_source' => 'Cryptographic random bytes',
'deterministic' => false,
'note' => 'UUIDv4 contains no embedded metadata'
]
Use Cases
- Universally unique IDs with no ordering or predictability
- Public identifiers (e.g. URLs, tokens)
- Safe for high-scale distributed systems with low collision risk
💡 Tip: UUIDv4 is one of the most common and widely supported UUID types — great default for most use cases where uniqueness is the priority.