Skip to content

Latest commit

 

History

History
56 lines (45 loc) · 2.25 KB

customize.rst

File metadata and controls

56 lines (45 loc) · 2.25 KB

Customization

customize/ordered-time-codec customize/timestamp-first-comb-codec customize/calculators customize/validators customize/factory

ramsey/uuid offers a variety of ways to modify the standard behavior of the library through dependency injection. Using FeatureSet, UuidFactory, and :phpUuid::setFactory() <Ramsey\\Uuid\\Uuid::setFactory()>, you are able to replace just about any builder, codec, converter, generator, provider, and more.

Ordered-time Codec

The ordered-time codec exists to rearrange the bytes of a version 1, Gregorian time UUID so that the timestamp portion of the UUID is monotonically increasing. To learn more, see customize.ordered-time-codec.

Timestamp-first COMB Codec

The timestamp-first COMB codec replaces part of a version 4, random UUID with a timestamp, so that the UUID becomes monotonically increasing. To learn more, see customize.timestamp-first-comb-codec.

Using a Custom Calculator

It's possible to replace the default calculator ramsey/uuid uses. If your requirements require a different solution for making calculations, see customize.calculators.

Using a Custom Validator

If your requirements require a different level of validation or a different UUID format, you may replace the default validator. See customize.validators, to learn more.

Replace the Default Factory

Not only are you able to inject alternate builders, codecs, etc. into the factory and use the factory to generate UUIDs, you may also replace the global, static factory used by the static methods on the Uuid class. To find out how, see customize.factory.