File: customize.rst

package info (click to toggle)
php-ramsey-uuid 4.7.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,124 kB
  • sloc: php: 13,359; xml: 194; python: 54; makefile: 16
file content (56 lines) | stat: -rw-r--r-- 2,299 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
.. _customize:

=============
Customization
=============

.. toctree::
    :titlesonly:
    :hidden:

    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
:php:meth:`Uuid::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 :ref:`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 :ref:`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
    :ref:`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
    :ref:`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 :ref:`customize.factory`.


.. _UuidFactory: https://github.com/ramsey/uuid/blob/4.x/src/UuidFactory.php
.. _FeatureSet: https://github.com/ramsey/uuid/blob/4.x/src/FeatureSet.php
.. _codec: https://github.com/ramsey/uuid/tree/4.x/src/Codec
.. _builder: https://github.com/ramsey/uuid/tree/4.x/src/Builder
.. _converter: https://github.com/ramsey/uuid/tree/4.x/src/Converter
.. _provider: https://github.com/ramsey/uuid/tree/4.x/src/Provider
.. _generator: https://github.com/ramsey/uuid/tree/4.x/src/Generator