|
| 1 | +.. index:: |
| 2 | + single: Polyfill |
| 3 | + single: PHP |
| 4 | + single: Components; Polyfill |
| 5 | + |
| 6 | +The Symfony Polyfill / UUID Component |
| 7 | +===================================== |
| 8 | + |
| 9 | + This component provides ``uuid_*`` functions to users who run PHP versions |
| 10 | + without the UUID extension. |
| 11 | + |
| 12 | +Installation |
| 13 | +------------ |
| 14 | + |
| 15 | +.. code-block:: terminal |
| 16 | +
|
| 17 | + $ composer require symfony/polyfill-uuid |
| 18 | +
|
| 19 | +.. include:: /components/require_autoload.rst.inc |
| 20 | + |
| 21 | +Usage |
| 22 | +----- |
| 23 | + |
| 24 | +Once this component is installed in your application, you can use the following |
| 25 | +functions, no matter if the `PHP UUID extension`_ is installed or not in your |
| 26 | +server. |
| 27 | + |
| 28 | +Provided Constants |
| 29 | +~~~~~~~~~~~~~~~~~~ |
| 30 | + |
| 31 | +* ``UUID_VARIANT_NCS`` (value = 0) |
| 32 | +* ``UUID_VARIANT_DCE`` (value = 1) |
| 33 | +* ``UUID_VARIANT_MICROSOFT`` (value = 2) |
| 34 | +* ``UUID_VARIANT_OTHER`` (value = 3) |
| 35 | +* ``UUID_TYPE_DEFAULT`` (value = 0) |
| 36 | +* ``UUID_TYPE_TIME`` (value = 1) |
| 37 | +* ``UUID_TYPE_DCE`` (value = 4) |
| 38 | +* ``UUID_TYPE_NAME`` (value = 1) |
| 39 | +* ``UUID_TYPE_RANDOM`` (value = 4) |
| 40 | +* ``UUID_TYPE_NULL`` (value = -1) |
| 41 | +* ``UUID_TYPE_INVALID`` (value = -42) |
| 42 | + |
| 43 | +Provided Functions |
| 44 | +~~~~~~~~~~~~~~~~~~ |
| 45 | + |
| 46 | +* :phpfunction:`uuid_create` |
| 47 | +* :phpfunction:`uuid_is_valid` |
| 48 | +* :phpfunction:`uuid_compare` |
| 49 | +* :phpfunction:`uuid_is_null` |
| 50 | +* :phpfunction:`uuid_type` |
| 51 | +* :phpfunction:`uuid_variant` |
| 52 | +* :phpfunction:`uuid_time` |
| 53 | +* :phpfunction:`uuid_mac` |
| 54 | +* :phpfunction:`uuid_parse` |
| 55 | +* :phpfunction:`uuid_unparse` |
| 56 | + |
| 57 | +.. _`PHP UUID extension`: https://pecl.php.net/package/uuid |
0 commit comments