Skip to content

Commit 1d60f1f

Browse files
committed
[Uuid] 17258 Add documentation for Uuid 7 and 8
1 parent 6e6bef4 commit 1d60f1f

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

components/uid.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ to create each type of UUID::
6363
// It's defined in http://gh.peabody.io/uuidv6/
6464
$uuid = Uuid::v6(); // $uuid is an instance of Symfony\Component\Uid\UuidV6
6565

66+
// UUID version 7 features a time-ordered value field derived from the widely implemented and well known
67+
// Unix Epoch timestamp source, the number of milliseconds seconds since midnight 1 Jan 1970 UTC, leap seconds excluded.
68+
// As well as improved entropy characteristics over versions 1 or 6.
69+
$uuid = Uuid::v7();
70+
71+
// UUID version 8 provides an RFC-compatible format for experimental or vendor-specific use cases.
72+
// The only requirement is that the variant and version bits
73+
// MUST be set as defined in Section 4:
74+
// https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#variant_and_version_fields
75+
// UUIDv8's uniqueness will be implementation-specific and SHOULD NOT be assumed.
76+
$uuid = Uuid::v8();
77+
78+
.. versionadded:: 6.2
79+
80+
Versions 7 and 8 were introduced in Symfony 6.2.
81+
6682
If your UUID value is already generated in another format, use any of the
6783
following methods to create a ``Uuid`` object from it::
6884

reference/constraints/Uuid.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ will allow alternate input formats like:
112112
``versions``
113113
~~~~~~~~~~~~
114114

115-
**type**: ``int[]`` **default**: ``[1,2,3,4,5,6]``
115+
**type**: ``int[]`` **default**: ``[1,2,3,4,5,6,7,8]``
116116

117-
This option can be used to only allow specific `UUID versions`_. Valid versions are 1 - 6.
117+
This option can be used to only allow specific `UUID versions`_. Valid versions are 1 - 8.
118118
The following PHP constants can also be used:
119119

120120
* ``Uuid::V1_MAC``
@@ -123,8 +123,14 @@ The following PHP constants can also be used:
123123
* ``Uuid::V4_RANDOM``
124124
* ``Uuid::V5_SHA1``
125125
* ``Uuid::V6_SORTABLE``
126+
* ``Uuid::V7_SORTABLE``
127+
* ``Uuid::V8_CUSTOM``
126128

127-
All six versions are allowed by default.
129+
.. versionadded:: 6.2
130+
131+
Versions 7 and 8 were introduced in Symfony 6.2.
132+
133+
All versions are allowed by default.
128134

129135
.. _`Universally unique identifier (UUID)`: https://en.wikipedia.org/wiki/Universally_unique_identifier
130136
.. _`RFC 4122`: https://tools.ietf.org/html/rfc4122

0 commit comments

Comments
 (0)