From a3c42994c95c5b5a1cb764b4b6e91bb98a49c57b Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Sun, 29 Jun 2025 14:51:48 +0200 Subject: [PATCH] [Uid] Add microsecond precision to UUIDv7 and optimize on x64 --- components/uid.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/uid.rst b/components/uid.rst index b4083765436..46c710a0fd5 100644 --- a/components/uid.rst +++ b/components/uid.rst @@ -120,7 +120,7 @@ sortable (like :ref:`ULIDs `). It's more efficient for database indexing **UUID v7** (UNIX timestamp) Generates time-ordered UUIDs based on a high-resolution Unix Epoch timestamp -source (the number of milliseconds since midnight 1 Jan 1970 UTC, leap seconds excluded) +source (the number of microseconds since midnight 1 Jan 1970 UTC, leap seconds excluded) (`read the UUIDv7 spec `__). It's recommended to use this version over UUIDv1 and UUIDv6 because it provides better entropy (and a more strict chronological order of UUID generation):: @@ -130,6 +130,10 @@ better entropy (and a more strict chronological order of UUID generation):: $uuid = Uuid::v7(); // $uuid is an instance of Symfony\Component\Uid\UuidV7 +.. versionadded:: 7.4 + + In Symfony 7.4, the precision was increased from milliseconds to microseconds. + **UUID v8** (custom) Provides an RFC-compatible format intended for experimental or vendor-specific use cases