The Symfony Polyfill / UUID Component

This component provides uuid_* functions to users who run PHP versions without the UUID extension.

Installation

1
$ composer require symfony/polyfill-uuid

注釈

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)