Skip to content

Upgrading ramsey/uuid 3 to 4

Breaking3.9.7 → 4.9.4Breaking4Platform1Deprecated28New40Changed58Fixed34Other1

BreakingUpgrade verdict

4 breaking changes and a platform requirement change.

  • Remove the following bytes generators and recommend Generator\RandomBytesGenerator as a suitable replacement.
  • Remove Exception\UnsatisfiedDependencyException.
  • Remove the method Provider\TimeProviderInterface::currentTime().
  • Remove currentTime() method from Provider\Time\FixedTimeProvider and Provider\Time\SystemTimeProvider; it had previously been removed from Provider\TimeProviderInterface.
Top 5 of 27 that need code or config changes

ramsey/uuid publishes an official migration guide for version 4. It covers more than the release notes do.

Upgrade guide ↗

PHP requirement changed in 4.3.0: ^5.4 | ^7.0 | ^8.0 → ^8.0.

Breaking4
Remove the following bytes generators and recommend Generator\RandomBytesGenerator as a suitable replacement.
Generator\RandomBytesGeneratorGenerator\MtRandGeneratorGenerator\OpenSslGeneratorGenerator\SodiumRandomGenerator
Remove Exception\UnsatisfiedDependencyException.
Exception\UnsatisfiedDependencyException
Remove the method Provider\TimeProviderInterface::currentTime().
Provider\TimeProviderInterface::currentTime()Provider\TimeProviderInterface::getTime()
Remove currentTime() method from Provider\Time\FixedTimeProvider and Provider\Time\SystemTimeProvider; it had previously been removed from Provider\TimeProviderInterface.
currentTime()Provider\Time\FixedTimeProviderProvider\Time\SystemTimeProviderProvider\TimeProviderInterface
Platform1
Remove support for PHP 7.2, 7.3, and 7.4.
Deprecated22
Deprecates Ramsey\Uuid\Codec\OrderedTimeCodec, to be removed in 5.0.0; migrate to version 6 UUIDs.
Ramsey\Uuid\Codec\OrderedTimeCodec
Deprecates Ramsey\Uuid\Codec\TimestampFirstCombCodec, to be removed in 5.0.0; migrate to version 7 UUIDs.
Ramsey\Uuid\Codec\TimestampFirstCombCodec
Deprecates Ramsey\Uuid\Codec\TimestampLastCombCodec, to be removed in 5.0.0; use Ramsey\Uuid\Codec\StringCodec instead.
Ramsey\Uuid\Codec\TimestampLastCombCodecRamsey\Uuid\Codec\StringCodec
Deprecates Ramsey\Uuid\Generator\CombGenerator, to be removed in 5.0.0; migrate to version 7 UUIDs.
Ramsey\Uuid\Generator\CombGenerator
Ramsey\Uuid\Nonstandard\UuidV6 is deprecated in favor of Ramsey\Uuid\Rfc4122\UuidV6.
Ramsey\Uuid\Nonstandard\UuidV6Ramsey\Uuid\Rfc4122\UuidV6
Ramsey\Uuid\Uuid::UUID_TYPE_PEABODY; use Ramsey\Uuid\Uuid::UUID_TYPE_REORDERED_TIME instead.
Ramsey\Uuid\Uuid::UUID_TYPE_PEABODYRamsey\Uuid\Uuid::UUID_TYPE_REORDERED_TIME
Ramsey\Uuid\Generator\RandomLibAdapter.
Ramsey\Uuid\Generator\RandomLibAdapter
Ramsey\Uuid\Builder\BuilderCollection.
Ramsey\Uuid\Builder\BuilderCollection
Ramsey\Uuid\Provider\Node\NodeProviderCollection.
Ramsey\Uuid\Provider\Node\NodeProviderCollection
Dependency on ramsey/collection.
The Uuid::UUID_TYPE_IDENTIFIER constant is deprecated.
Uuid::UUID_TYPE_IDENTIFIERUuid::UUID_TYPE_DCE_SECURITY
The Uuid::VALID_PATTERN constant is deprecated.
Uuid::VALID_PATTERNValidator\GenericValidator::getPattern()Rfc4122\Validator::getPattern()Validator\GenericValidator::VALID_PATTERN
The following methods from UuidInterface and Uuid are deprecated.
UuidInterfaceUuidRfc4122\FieldsInterfaceUuid::getFields()getClockSeqHiAndReservedHex()getClockSeqLowHex()Type\HexadecimalMath\CalculatorInterface::toIntegerValue()Type\IntegergetClockSeqHiAndReserved()getClockSeqLow()
getDateTime() on UuidInterface and Uuid is deprecated.
getDateTime()UuidInterfaceUuidRfc4122\UuidV1Nonstandard\UuidV6
getUrn() on UuidInterface and Uuid is deprecated.
getUrn()UuidInterfaceUuidRfc4122\UuidInterface
The following methods are deprecated and have no direct replacements.
UuidInterface::getHex()UuidInterface::getLeastSignificantBitsHex()UuidInterface::getMostSignificantBitsHex()Uuid::getLeastSignificantBitsHex()Uuid::getMostSignificantBitsHex()Uuid::getLeastSignificantBits()
The classes for representing and generating degraded UUIDs are deprecated.
Builder\DegradedUuidBuilderConverter\Number\DegradedNumberConverterConverter\Time\DegradedTimeConverterDegradedUuid
UuidInterface::getNumberConverter() and Uuid::getNumberConverter() are deprecated.
UuidInterface::getNumberConverter()Uuid::getNumberConverter()
Builder\DefaultUuidBuilder is deprecated; transition to Rfc4122\UuidBuilder.
Builder\DefaultUuidBuilderRfc4122\UuidBuilder
Converter\Number\BigNumberConverter is deprecated; transition to Converter\Number\GenericNumberConverter.
Converter\Number\BigNumberConverterConverter\Number\GenericNumberConverter
Converter\Time\BigNumberTimeConverter is deprecated; transition to Converter\Time\GenericTimeConverter.
Converter\Time\BigNumberTimeConverterConverter\Time\GenericTimeConverter
Provider\TimeProviderInterface::currentTime() is deprecated; transition to the getTimestamp() method on the same interface.
Provider\TimeProviderInterface::currentTime()getTimestamp()