The Symfony Polyfill / UUID Component
Warning: You are browsing the documentation for Symfony 3.x, which is no longer maintained.
Read the updated version of this page for Symfony 7.2 (the current stable version).
This component provides
uuid_*
functions to users who run PHP versions without the UUID extension.
Installation
1
$ composer require symfony/polyfill-uuid
Note
If you install this component outside of a Symfony application, you must
require the vendor/autoload.php
file in your code to enable the class
autoloading mechanism provided by Composer. Read
this article for more details.
Usage
Once this component is installed in your application, you can use the following functions, no matter if the PHP UUID extension is installed or not in your server.
Provided Constants
UUID_VARIANT_NCS
(value = 0)UUID_VARIANT_DCE
(value = 1)UUID_VARIANT_MICROSOFT
(value = 2)UUID_VARIANT_OTHER
(value = 3)UUID_TYPE_DEFAULT
(value = 0)UUID_TYPE_TIME
(value = 1)UUID_TYPE_DCE
(value = 4)UUID_TYPE_NAME
(value = 1)UUID_TYPE_RANDOM
(value = 4)UUID_TYPE_NULL
(value = -1)UUID_TYPE_INVALID
(value = -42)