customize.rst 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .. _customize:
  2. =============
  3. Customization
  4. =============
  5. .. toctree::
  6. :titlesonly:
  7. :hidden:
  8. customize/ordered-time-codec
  9. customize/timestamp-first-comb-codec
  10. customize/calculators
  11. customize/validators
  12. customize/factory
  13. ramsey/uuid offers a variety of ways to modify the standard behavior of the
  14. library through dependency injection. Using `FeatureSet`_, `UuidFactory`_, and
  15. :php:meth:`Uuid::setFactory() <Ramsey\\Uuid\\Uuid::setFactory()>`, you are able
  16. to replace just about any `builder`_, `codec`_, `converter`_, `generator`_,
  17. `provider`_, and more.
  18. Ordered-time Codec
  19. The ordered-time codec exists to rearrange the bytes of a version 1,
  20. Gregorian time UUID so that the timestamp portion of the UUID is
  21. monotonically increasing. To learn more, see :ref:`customize.ordered-time-codec`.
  22. Timestamp-first COMB Codec
  23. The timestamp-first COMB codec replaces part of a version 4, random UUID
  24. with a timestamp, so that the UUID becomes monotonically increasing. To
  25. learn more, see :ref:`customize.timestamp-first-comb-codec`.
  26. Using a Custom Calculator
  27. It's possible to replace the default calculator ramsey/uuid uses. If your
  28. requirements require a different solution for making calculations, see
  29. :ref:`customize.calculators`.
  30. Using a Custom Validator
  31. If your requirements require a different level of validation or a different
  32. UUID format, you may replace the default validator. See
  33. :ref:`customize.validators`, to learn more.
  34. Replace the Default Factory
  35. Not only are you able to inject alternate builders, codecs, etc. into the
  36. factory and use the factory to generate UUIDs, you may also replace the
  37. global, static factory used by the static methods on the Uuid class. To find
  38. out how, see :ref:`customize.factory`.
  39. .. _UuidFactory: https://github.com/ramsey/uuid/blob/4.x/src/UuidFactory.php
  40. .. _FeatureSet: https://github.com/ramsey/uuid/blob/4.x/src/FeatureSet.php
  41. .. _codec: https://github.com/ramsey/uuid/tree/4.x/src/Codec
  42. .. _builder: https://github.com/ramsey/uuid/tree/4.x/src/Builder
  43. .. _converter: https://github.com/ramsey/uuid/tree/4.x/src/Converter
  44. .. _provider: https://github.com/ramsey/uuid/tree/4.x/src/Provider
  45. .. _generator: https://github.com/ramsey/uuid/tree/4.x/src/Generator