Download the PHP package oittaa/uuid without Composer
On this page you can find all versions of the php package oittaa/uuid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package uuid
Short Description A small PHP class for generating RFC 9562 universally unique identifiers (UUID) from version 3 to version 8.
License MIT
Informations about the package uuid
uuid-php
A small PHP class for generating RFC 9562 universally unique identifiers (UUID) from version 3 to version 8.
If all you want is a unique ID, you should call uuid4()
.
Implementations SHOULD utilize UUIDv7 instead of UUIDv1 and UUIDv6 if possible.
If you're regularly generating more than thousand UUIDs per second, you might want to use uuid8()
instead of uuid7()
. This implementation of uuid8()
sacrifices some entropy compared to uuid7()
, but offers 100 nanosecond granularity while being otherwise compatible.
Minimal UUID v4 implementation
Credits go to this answer on Stackoverflow for this minimal RFC 9562 compliant solution.
Minimal UUID v7 implementation
Installation
If you need comparison tools or sortable identifiers like in versions 6, 7, and 8, you might find this small and fast package useful. It doesn't require any other dependencies.
Usage
How to generate
Tools
UUIDv6 Field and Bit Layout
UUIDv7 Field and Bit Layout
UUIDv8 Field and Bit Layout
unix_ts_ms
: 48 bit big-endian unsigned number of Unix epoch timestamp with millisecond level of precisionver
: The 4 bit UUIDv8 version (1000)subsec
: 12 bits allocated to sub-second precision valuesvar
: 2 bit UUID variant (10)sub
: 2 bits allocated to sub-second precision valuesrand
: The remaining 60 bits are filled with pseudo-random data
14 bits dedicated to sub-second precision provide 100 nanosecond resolution. The unix_ts_ms
and subsec
fields guarantee the order of UUIDs generated within the same timestamp by monotonically incrementing the timer.