123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- .. _reference.uuid:
- ====
- Uuid
- ====
- Ramsey\Uuid\Uuid provides static methods for the most common functionality for
- generating and working with UUIDs. It also provides constants used throughout
- the ramsey/uuid library.
- .. php:namespace:: Ramsey\Uuid
- .. php:class:: Uuid
- .. php:const:: UUID_TYPE_TIME
- :ref:`rfc4122.version1` UUID.
- .. php:const:: UUID_TYPE_DCE_SECURITY
- :ref:`rfc4122.version2` UUID.
- .. php:const:: UUID_TYPE_HASH_MD5
- :ref:`rfc4122.version3` UUID.
- .. php:const:: UUID_TYPE_RANDOM
- :ref:`rfc4122.version4` UUID.
- .. php:const:: UUID_TYPE_HASH_SHA1
- :ref:`rfc4122.version5` UUID.
- .. php:const:: UUID_TYPE_REORDERED_TIME
- :ref:`rfc4122.version6` UUID.
- .. php:const:: UUID_TYPE_PEABODY
- *Deprecated.* Use :php:const:`Uuid::UUID_TYPE_REORDERED_TIME` instead.
- .. php:const:: UUID_TYPE_UNIX_TIME
- :ref:`rfc4122.version7` UUID.
- .. php:const:: NAMESPACE_DNS
- The name string is a fully-qualified domain name.
- .. php:const:: NAMESPACE_URL
- The name string is a URL.
- .. php:const:: NAMESPACE_OID
- The name string is an `ISO object identifier (OID)`_.
- .. php:const:: NAMESPACE_X500
- The name string is an `X.500`_ `DN`_ in `DER`_ or a text output format.
- .. php:const:: NIL
- The nil UUID is a special form of UUID that is specified to have all 128
- bits set to zero.
- .. php:const:: DCE_DOMAIN_PERSON
- DCE Security principal (person) domain.
- .. php:const:: DCE_DOMAIN_GROUP
- DCE Security group domain.
- .. php:const:: DCE_DOMAIN_ORG
- DCE Security organization domain.
- .. php:const:: RESERVED_NCS
- Variant identifier: reserved, NCS backward compatibility.
- .. php:const:: RFC_4122
- Variant identifier: the UUID layout specified in RFC 4122.
- .. php:const:: RESERVED_MICROSOFT
- Variant identifier: reserved, Microsoft Corporation backward compatibility.
- .. php:const:: RESERVED_FUTURE
- Variant identifier: reserved for future definition.
- .. php:staticmethod:: uuid1([$node[, $clockSeq]])
- Generates a version 1, Gregorian time UUID. See :ref:`rfc4122.version1`.
- :param Ramsey\\Uuid\\Type\\Hexadecimal|null $node: An optional hexadecimal node to use
- :param int|null $clockSeq: An optional clock sequence to use
- :returns: A version 1 UUID
- :returntype: Ramsey\\Uuid\\Rfc4122\\UuidV1
- .. php:staticmethod:: uuid2($localDomain[, $localIdentifier[, $node[, $clockSeq]]])
- Generates a version 2, DCE Security UUID. See :ref:`rfc4122.version2`.
- :param int $localDomain: The local domain to use (one of :php:const:`Uuid::DCE_DOMAIN_PERSON`, :php:const:`Uuid::DCE_DOMAIN_GROUP`, or :php:const:`Uuid::DCE_DOMAIN_ORG`)
- :param Ramsey\\Uuid\\Type\\Integer|null $localIdentifier: A local identifier for the domain (defaults to system UID or GID for *person* or *group*)
- :param Ramsey\\Uuid\\Type\\Hexadecimal|null $node: An optional hexadecimal node to use
- :param int|null $clockSeq: An optional clock sequence to use
- :returns: A version 2 UUID
- :returntype: Ramsey\\Uuid\\Rfc4122\\UuidV2
- .. php:staticmethod:: uuid3($ns, $name)
- Generates a version 3, name-based (MD5) UUID. See :ref:`rfc4122.version3`.
- :param Ramsey\\Uuid\\UuidInterface|string $ns: The namespace for this identifier
- :param string $name: The name from which to generate an identifier
- :returns: A version 3 UUID
- :returntype: Ramsey\\Uuid\\Rfc4122\\UuidV3
- .. php:staticmethod:: uuid4()
- Generates a version 4, random UUID. See :ref:`rfc4122.version4`.
- :returns: A version 4 UUID
- :returntype: Ramsey\\Uuid\\Rfc4122\\UuidV4
- .. php:staticmethod:: uuid5($ns, $name)
- Generates a version 5, name-based (SHA-1) UUID. See :ref:`rfc4122.version5`.
- :param Ramsey\\Uuid\\UuidInterface|string $ns: The namespace for this identifier
- :param string $name: The name from which to generate an identifier
- :returns: A version 5 UUID
- :returntype: Ramsey\\Uuid\\Rfc4122\\UuidV5
- .. php:staticmethod:: uuid6([$node[, $clockSeq]])
- Generates a version 6, reordered time UUID. See :ref:`rfc4122.version6`.
- :param Ramsey\\Uuid\\Type\\Hexadecimal|null $node: An optional hexadecimal node to use
- :param int|null $clockSeq: An optional clock sequence to use
- :returns: A version 6 UUID
- :returntype: Ramsey\\Uuid\\Rfc4122\\UuidV6
- .. php:staticmethod:: uuid7([$dateTime])
- Generates a version 7, Unix Epoch time UUID. See :ref:`rfc4122.version7`.
- :param DateTimeInterface|null $dateTime: The date from which to create the UUID instance
- :returns: A version 7 UUID
- :returntype: Ramsey\\Uuid\\Rfc4122\\UuidV7
- .. php:staticmethod:: fromString($uuid)
- Creates an instance of UuidInterface from the string standard
- representation.
- :param string $uuid: The string standard representation of a UUID
- :returntype: Ramsey\\Uuid\\UuidInterface
- .. php:staticmethod:: fromBytes($bytes)
- Creates an instance of UuidInterface from a 16-byte string.
- :param string $bytes: A 16-byte binary string representation of a UUID
- :returntype: Ramsey\\Uuid\\UuidInterface
- .. php:staticmethod:: fromInteger($integer)
- Creates an instance of UuidInterface from a 128-bit string integer.
- :param string $integer: A 128-bit string integer representation of a UUID
- :returntype: Ramsey\\Uuid\\UuidInterface
- .. php:staticmethod:: fromDateTime($dateTime[, $node[, $clockSeq]])
- Creates a version 1 UUID instance from a `DateTimeInterface
- <https://www.php.net/datetimeinterface>`_ instance.
- :param DateTimeInterface $dateTime: The date from which to create the UUID instance
- :param Ramsey\\Uuid\\Type\\Hexadecimal|null $node: An optional hexadecimal node to use
- :param int|null $clockSeq: An optional clock sequence to use
- :returns: A version 1 UUID
- :returntype: Ramsey\\Uuid\\Rfc4122\\UuidV1
- .. php:staticmethod:: isValid($uuid)
- Validates the string standard representation of a UUID.
- :param string $uuid: The string standard representation of a UUID
- :returntype: ``bool``
- .. php:staticmethod:: setFactory($factory)
- Sets the factory used to create UUIDs.
- :param Ramsey\\Uuid\\UuidFactoryInterface $factory: A UUID factory to use for all UUID generation
- :returntype: void
- .. _ISO object identifier (OID): http://www.oid-info.com
- .. _X.500: https://en.wikipedia.org/wiki/X.500
- .. _DN: https://en.wikipedia.org/wiki/Distinguished_Name
- .. _DER: https://www.itu.int/rec/T-REC-X.690/
|