ramsey/uuid
Generate and work with UUIDs in PHP using ramsey/uuid. Create v1, v4, and other UUID types, parse and validate UUID strings, and integrate easily via Composer. Well-documented, widely used, and standards-aware for reliable identifiers.
(int) cast to avoid float-string cast warnings in PHP 8.5.^0.8.16 from ^0.8.8. ramsey/uuid had been using BigInteger::toBytes() in UnixTimeGenerator (for version 7 UUIDs) since v4.6.0, but it wasn't added to brick/math until v0.8.16.Full Changelog: https://github.com/ramsey/uuid/compare/4.9.1...4.9.2
^0.14; fixed in #617.microtime() instead of DateTimeImmutable in Ramsey\Uuid\Generator\UnixTimeGenerator.Full Changelog: https://github.com/ramsey/uuid/compare/4.9.0...4.9.1
[@pure](https://github.com/pure) annotations to the following (#605):
Ramsey\Uuid\Codec\CodecInterface::encode()Ramsey\Uuid\Codec\CodecInterface::encodeBinary()Ramsey\Uuid\Codec\CodecInterface::decode()Ramsey\Uuid\Codec\CodecInterface::decodeBytes()Ramsey\Uuid\Fields\FieldsInterface::getBytes()Ramsey\Uuid\Math\CalculatorInterface::add()Ramsey\Uuid\Math\CalculatorInterface::subtract()Ramsey\Uuid\Math\CalculatorInterface::multiply()Ramsey\Uuid\Math\CalculatorInterface::divide()Ramsey\Uuid\Math\CalculatorInterface::fromBase()Ramsey\Uuid\Math\CalculatorInterface::toBase()Ramsey\Uuid\Math\CalculatorInterface::toHexadecimal()Ramsey\Uuid\Math\CalculatorInterface::toInteger()Ramsey\Uuid\Nonstandard\UuidRamsey\Uuid\Rfc4122\Fields::isMax()Ramsey\Uuid\Rfc4122\FieldsInterface::getVersion()Ramsey\Uuid\Rfc4122\FieldsInterface::isNil()Ramsey\Uuid\Type\Time::getSeconds()Ramsey\Uuid\Type\Time::getMicroseconds()Ramsey\Uuid\Type\TypeInterface::toString()Ramsey\Uuid\UuidInterface::getBytes()Ramsey\Uuid\UuidInterface::toString()Ramsey\Uuid\Validator\ValidatorInterface::validate()[@pure](https://github.com/pure) annotations that were removed in 4.8.0 (#603).Full Changelog: https://github.com/ramsey/uuid/compare/4.8.1...4.9.0
Full Changelog: https://github.com/ramsey/uuid/compare/4.8.0...4.8.1
The following will be removed in ramsey/uuid 5.0.0:
Ramsey\Uuid\Codec\OrderedTimeCodec is deprecated; please migrate to version 6 UUIDs.Ramsey\Uuid\Codec\TimestampFirstCombCodec is deprecated; please migrate to version 7 UUIDs.Ramsey\Uuid\Codec\TimestampLastCombCodec is deprecated; please use Ramsey\Uuid\Codec\StringCodec instead.Ramsey\Uuid\Generator\CombGenerator is deprecated; please migrate to version 7 UUIDs.^0.13; fixed in #589.str_getcsv() to avoid deprecation notice in PHP 8.4; fixed in #590.Uuid::fromBytes(), Uuid::fromString(), Uuid::fromDateTime(), Uuid::fromHexadecimal(), and Uuid::fromInteger() to note that each can throw InvalidArgumentException, addressing PHPStan errors occurring at call sites; fixed in #552.getVariant() for MaxUuid now correctly returns Uuid::RESERVED_FUTURE, as specified in RFC 9562, section 5.10.getVariant() for NilUuid now correctly returns Uuid::RESERVED_NCS, as specified in RFC 9562, section 5.9.Full Changelog: https://github.com/ramsey/uuid/compare/4.7.6...4.8.0
^0.12.Uuid::fromHexadecimal() and UuidFactory::fromHexadecimal(). These methods are not required by the interfaces.00:00:00:00:00:00).#[ReturnTypeWillChange] to Uuid::jsonSerialize() method.Ramsey\Uuid\Uuid::uuid8() to generate version 8 UUIDs.Ramsey\Uuid\Rfc4122\UuidV8.Ramsey\Uuid\Uuid::UUID_TYPE_CUSTOM exists for version 8 UUIDs.Nonstandard namespace to the Rfc4122 namespace. Version 6 UUIDs are defined in New UUID Formats, section 5.1. While still an Internet-Draft version 6 is stable and unlikely to change in any way that breaks compatibility.Ramsey\Uuid\Uuid::uuid7() to generate version 7 UUIDs.Ramsey\Uuid\Rfc4122\UuidV7.Ramsey\Uuid\Uuid::UUID_TYPE_UNIX_TIME exists for version 7 UUIDs.Ramsey\Uuid\Converter\Time\UnixTimeConverter and Ramsey\Uuid\Generator\UnixTimeGenerator to support version 7 UUID generation.Ramsey\Uuid\Uuid::MAX and Ramsey\Uuid\Rfc4122\MaxUuid.^0.8.8.The following will be removed in ramsey/uuid 5.0.0:
Ramsey\Uuid\Nonstandard\UuidV6 is deprecated in favor of Ramsey\Uuid\Rfc4122\UuidV6.Ramsey\Uuid\Uuid::UUID_TYPE_PEABODY; use Ramsey\Uuid\Uuid::UUID_TYPE_REORDERED_TIME instead.Ramsey\Uuid\Uuid::isValid(), Psalm now asserts the UUID is a non-empty-string when it is valid.getVariant() now returns a 2 when called on a nil UUID.UuidInterface::getUrn().The following will be removed in ramsey/uuid 5.0.0:
Ramsey\Uuid\Generator\RandomLibAdapterext-ctype extension. For applications that run in environments where
the ext-ctype is not present, please require a polyfill, such as
symfony/polyfill-ctype.iterable<UuidBuilderInterface> instead of BuilderCollection types.iterable<NodeProviderInterface> instead of NodeProviderCollection types.The following will be removed in ramsey/uuid 5.0.0:
Ramsey\Uuid\Builder\BuilderCollectionRamsey\Uuid\Provider\Node\NodeProviderCollectionLazyUuidFromString.^8.0 in the PHP version requirement.^8.0 in the PHP version requirement.^8.0 in the PHP version requirement.^8.0 in the PHP version requirement.~8.1.0 to prevent installations on 8.2 until the library is ready.~8.0.0 to indicate it does not support PHP 8.1.~8.0.0 to indicate it does not support PHP 8.1.~8.1.0 to prevent installations on 8.2 until the library is ready.Uuid::fromString() signature. The change from string to non-empty-string on the parameter annotation introduced a BC break for those using static analysis tools. This release reverts this change and provides an assertion to guard against empty strings. See ramsey/uuid#383.Ramsey\Uuid\Exception\UuidExceptionInterface for all ramsey/uuid exceptions to implement. See ramsey/uuid#340.How can I help you explore Laravel packages today?