Skip to content
Merged
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
11 changes: 11 additions & 0 deletions components/uid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,22 @@ to create each type of UUID::
$uuid = Uuid::v3($namespace, $name); // $uuid is an instance of Symfony\Component\Uid\UuidV3
$uuid = Uuid::v5($namespace, $name); // $uuid is an instance of Symfony\Component\Uid\UuidV5

// the namespaces defined by RFC 4122 are available as constants
// (see https://tools.ietf.org/html/rfc4122#appendix-C)
$uuid = Uuid::v3(Uuid::NAMESPACE_DNS, $name);
$uuid = Uuid::v3(Uuid::NAMESPACE_URL, $name);
$uuid = Uuid::v3(Uuid::NAMESPACE_OID, $name);
$uuid = Uuid::v3(Uuid::NAMESPACE_X500, $name);

// UUID type 6 is not part of the UUID standard. It's lexicographically sortable
// (like ULIDs) and contains a 60-bit timestamp and 63 extra unique bits.
// It's defined in http://gh.peabody.io/uuidv6/
$uuid = Uuid::v6(); // $uuid is an instance of Symfony\Component\Uid\UuidV6

.. versionadded:: 5.3

The ``Uuid::NAMESPACE_*`` constants were introduced in Symfony 5.3.

If your UUID is generated by another system, use the ``fromString()`` method to
create an object and make use of the utilities available for Symfony UUIDs::

Expand Down