ramsey/uuid
:snowflake: A PHP library for generating universally unique identifiers (UUIDs).
30 Releases
Latest: 3d ago
4.9.3Latest
🐛 Fixed
- Upgrade brick/math to support versions `^0.14` to `^0.17`; fixed in [#638](https://github.com/ramsey/uuid/pull/638).
- Add support for brick/match `^0.18`.
✨ New Contributors
- @delolmo made their first contribution in https://github.com/ramsey/uuid/pull/638
- Full Changelog: https://github.com/ramsey/uuid/compare/4.9.2...4.9.3
4.9.2
🐛 Fixed
- Remove explicit `(int)` cast to avoid float-string cast warnings in PHP 8.5.
- Bump the lowest supported version of brick/math to `^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
4.9.1
🐛 Fixed
- Allow brick/math version `^0.14`; fixed in [#617](https://github.com/ramsey/uuid/pull/617).
- Default to `microtime()` instead of `DateTimeImmutable` in `Ramsey\Uuid\Generator\UnixTimeGenerator`.
✨ New Contributors
- @stof made their first contribution in https://github.com/ramsey/uuid/pull/617
- Full Changelog: https://github.com/ramsey/uuid/compare/4.9.0...4.9.1
4.9.0
✨ Added
- Add new `@pure` annotations to the following ([#605](https://github.com/ramsey/uuid/pull/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()`
- + 16 more
🐛 Fixed
- Restore the `@pure` annotations that were removed in 4.8.0 ([#603](https://github.com/ramsey/uuid/pull/603)).
- ---
- Full Changelog: https://github.com/ramsey/uuid/compare/4.8.1...4.9.0
4.8.1
🐛 Fixed
- This tagged release ensures the stable documentation build matches the current stable release.
- Full Changelog: https://github.com/ramsey/uuid/compare/4.8.0...4.8.1
4.8.0
🗑️ Deprecated
- The following will be removed in ramsey/uuid 5.0.0:
- `Ramsey\Uuid\Codec\OrderedTimeCodec` is deprecated; please migrate to [version 6 UUIDs](https://uuid.ramsey.dev/en/stable/rfc4122/version6.html).
- `Ramsey\Uuid\Codec\TimestampFirstCombCodec` is deprecated; please migrate to [version 7 UUIDs](https://uuid.ramsey.dev/en/stable/rfc4122/version7.html).
- `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](https://uuid.ramsey.dev/en/stable/rfc4122/version7.html).
🐛 Fixed
- Allow brick/math version `^0.13`; fixed in [#589](https://github.com/ramsey/uuid/pull/589).
- Update call to `str_getcsv()` to avoid deprecation notice in PHP 8.4; fixed in [#590](https://github.com/ramsey/uuid/pull/590).
- Hexadecimal is never an empty string; fixed in [#593](https://github.com/ramsey/uuid/pull/593).
- Update docblocks for `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](https://github.com/ramsey/uuid/pull/552).
- `getVariant()` for `MaxUuid` now correctly returns `Uuid::RESERVED_FUTURE`, as specified in [RFC 9562, section 5.10](https://www.rfc-editor.org/rfc/rfc9562#section-5.10).
- `getVariant()` for `NilUuid` now correctly returns `Uuid::RESERVED_NCS`, as specified in [RFC 9562, section 5.9](https://www.rfc-editor.org/rfc/rfc9562#section-5.9).
✨ New Contributors
- @staabm made their first contribution in https://github.com/ramsey/uuid/pull/552
- @Chris53897 made their first contribution in https://github.com/ramsey/uuid/pull/568
- @jrfnl made their first contribution in https://github.com/ramsey/uuid/pull/584
- @PNardman made their first contribution in https://github.com/ramsey/uuid/pull/590
- @axlon made their first contribution in https://github.com/ramsey/uuid/pull/593
- @derrabus made their first contribution in https://github.com/ramsey/uuid/pull/589
- Full Changelog: https://github.com/ramsey/uuid/compare/4.7.6...4.8.0
4.7.6
🐛 Fixed
- Allow brick/math version `^0.12`.
4.7.5
🐛 Fixed
- Protect against UUIDv7 collisions within the same millisecond, as reported in [#518](https://github.com/ramsey/uuid/issues/518) and fixed in [#522](https://github.com/ramsey/uuid/pull/522).
- Improve the return type hint for `UuidInterface::compareTo()`.
4.7.4
🐛 Fixed
- Allow brick/math version `^0.11`.
- Add explicit `Stringable` interface to `UuidInterface`.
- Fix namespace conflict reported in [#490](https://github.com/ramsey/uuid/issues/490).
- Fix unserialize error with `OrderedTimeCodec` reported in [#494](https://github.com/ramsey/uuid/issues/494).
4.7.3
🐛 Fixed
- The original 4.7.2 tag accidentally pointed to a commit in the 5.x branch. I have replaced the 4.7.2 tag with a new tag that points to the correct commit, but I am creating this tag to help notify users and automated processes who might have already updated to the bad 4.7.2 tag ([#487](https://github.com/ramsey/uuid/issues/487)).
4.7.2
🐛 Fixed
- Amend Psalm assertion syntax on `Uuid::isValid()` to prevent incorrect type inference ([#486](https://github.com/ramsey/uuid/pull/486)).
- Re-tagged with the correct commit hash, since the first tag was pointing to a commit in the 5.x branch ([#487](https://github.com/ramsey/uuid/issues/487)).
4.7.1
🐛 Fixed
- Allow the use of ramsey/collection ^2.0 with ramsey/uuid.
4.7.0
✨ Added
- Add `Uuid::fromHexadecimal()` and `UuidFactory::fromHexadecimal()`. These methods are not required by the interfaces.
🐛 Fixed
- Ignore MAC addresses consisting of all zeroes (i.e., `00:00:00:00:00:00`).
3.9.7
🐛 Fixed
- Add `#[ReturnTypeWillChange]` to `Uuid::jsonSerialize()` method.
4.6.0
✨ Added
- Add support for version 8, custom UUIDs, as defined in [draft-ietf-uuidrev-rfc4122bis-00, section 5.8][version8]. While still an Internet-Draft, version 8 is stable and unlikely to change in any way that breaks compatibility.
- Use `Ramsey\Uuid\Uuid::uuid8()` to generate version 8 UUIDs.
- Version 8 UUIDs are of type `Ramsey\Uuid\Rfc4122\UuidV8`.
- The constant `Ramsey\Uuid\Uuid::UUID_TYPE_CUSTOM` exists for version 8 UUIDs.
🐛 Fixed
- Ensure monotonicity of version 7 UUIDs.
- [version8]: https://datatracker.ietf.org/doc/html/draft-ietf-uuidrev-rfc4122bis-00#section-5.8
4.5.1
🐛 Fixed
- Update RFC 4122 validator to recognize version 6 and 7 UUIDs.
4.5.0
✨ Added
- Promote version 6, reordered time UUIDs from the `Nonstandard` namespace to the `Rfc4122` namespace. Version 6 UUIDs are defined in [New UUID Formats, section 5.1][version6]. While still an Internet-Draft version 6 is stable and unlikely to change in any way that breaks compatibility.
- Add support for version 7, Unix Epoch time UUIDs, as defined in [New UUID Formats, section 5.2][version7]. While still an Internet-Draft, version 7 is stable and unlikely to change in any way that breaks compatibility.
- Use `Ramsey\Uuid\Uuid::uuid7()` to generate version 7 UUIDs.
- Version 7 UUIDs are of type `Ramsey\Uuid\Rfc4122\UuidV7`.
- The constant `Ramsey\Uuid\Uuid::UUID_TYPE_UNIX_TIME` exists for version 7 UUIDs.
- Add `Ramsey\Uuid\Converter\Time\UnixTimeConverter` and `Ramsey\Uuid\Generator\UnixTimeGenerator` to support version 7 UUID generation.
- Add support for [max UUIDs][] through `Ramsey\Uuid\Uuid::MAX` and `Ramsey\Uuid\Rfc4122\MaxUuid`.
📋 Changed
- The lowest version of brick/math allowed is now `^0.8.8`.
🗑️ Deprecated
- 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.
🐛 Fixed
- For `Ramsey\Uuid\Uuid::isValid()`, Psalm now asserts the UUID is a non-empty-string when it is valid.
- Nil UUIDs are properly treated as RFC 4122 variants, and `getVariant()` now returns a `2` when called on a nil UUID.
- [version6]: https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04#section-5.1
- [version7]: https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04#section-5.2
- [max uuids]: https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04#section-5.4
4.4.0
📋 Changed
- Allow brick/math 0.10.
- Remove dev dependency to moontoast/math.
- Un-deprecate `UuidInterface::getUrn()`.
4.3.1
🗑️ Deprecated
- The following will be removed in ramsey/uuid 5.0.0:
- `Ramsey\Uuid\Generator\RandomLibAdapter`
4.3.0
📋 Changed
- Remove support for PHP 7.2, 7.3, and 7.4. This is not a BC break, since
- Composer will do the right thing for your environment and select a compatible
- version of this library.
- Require `ext-ctype` extension. For applications that run in environments where
- the `ext-ctype` is not present, please require a polyfill, such as
- [symfony/polyfill-ctype](https://packagist.org/packages/symfony/polyfill-ctype).
- Use `iterable<UuidBuilderInterface>` instead of `BuilderCollection` types.
- Use `iterable<NodeProviderInterface>` instead of `NodeProviderCollection` types.
🗑️ Deprecated
- The following will be removed in ramsey/uuid 5.0.0:
- `Ramsey\Uuid\Builder\BuilderCollection`
- `Ramsey\Uuid\Provider\Node\NodeProviderCollection`
- Dependency on ramsey/collection
🐛 Fixed
- Support valid UUIDs in uppercase in `LazyUuidFromString`.
4.2.3
🐛 Fixed
- Switch back to `^8.0` in the PHP version requirement.
4.1.3
🐛 Fixed
- Switch back to `^8.0` in the PHP version requirement.
4.0.3
🐛 Fixed
- Switch back to `^8.0` in the PHP version requirement.
3.9.6
🐛 Fixed
- Switch back to `^8.0` in the PHP version requirement.
4.2.2
🐛 Fixed
- Indicate support for PHP 8.1, using `~8.1.0` to prevent installations on 8.2 until the library is ready.
4.1.2
🐛 Fixed
- Lock 4.1.x to `~8.0.0` to indicate it does not support PHP 8.1.
4.0.2
🐛 Fixed
- Lock 4.0.x to `~8.0.0` to indicate it does not support PHP 8.1.
3.9.5
🐛 Fixed
- Indicate support for PHP 8.1, using `~8.1.0` to prevent installations on 8.2 until the library is ready.
4.2.1
🐛 Fixed
- Fix *soft* BC break with `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](https://github.com/ramsey/uuid/pull/383).
4.2.0
✨ Added
- Add `Ramsey\Uuid\Exception\UuidExceptionInterface` for all ramsey/uuid exceptions to implement. See [ramsey/uuid#340](https://github.com/ramsey/uuid/pull/340).
🐛 Fixed
- Fix serialization of UUIDs. See [ramsey/uuid#361](https://github.com/ramsey/uuid/pull/361).
