Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions components/uid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ to create each type of UUID::
// It's defined in http://gh.peabody.io/uuidv6/
$uuid = Uuid::v6(); // $uuid is an instance of Symfony\Component\Uid\UuidV6

// UUID version 7 features a time-ordered value field derived from the widely implemented and well known
// Unix Epoch timestamp source, the number of seconds since midnight 1 Jan 1970 UTC, leap seconds excluded.
// As well as improved entropy characteristics over versions 1 or 6.
$uuid = Uuid::v7();

// UUID version 8 provides an RFC-compatible format for experimental or vendor-specific use cases.
// The only requirement is that the variant and version bits
// MUST be set as defined in Section 4:
// https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#variant_and_version_fields
// UUIDv8's uniqueness will be implementation-specific and SHOULD NOT be assumed.
$uuid = Uuid::v8();

.. versionadded:: 6.2

Versions 7 and 8 were introduced in Symfony 6.2.

If your UUID value is already generated in another format, use any of the
following methods to create a ``Uuid`` object from it::

Expand Down
12 changes: 9 additions & 3 deletions reference/constraints/Uuid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ will allow alternate input formats like:
``versions``
~~~~~~~~~~~~

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

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

* ``Uuid::V1_MAC``
Expand All @@ -123,8 +123,14 @@ The following PHP constants can also be used:
* ``Uuid::V4_RANDOM``
* ``Uuid::V5_SHA1``
* ``Uuid::V6_SORTABLE``
* ``Uuid::V7_MONOTONIC``
* ``Uuid::V8_CUSTOM``

All six versions are allowed by default.
.. versionadded:: 6.2

Versions 7 and 8 were introduced in Symfony 6.2.

All versions are allowed by default.

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