You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-7Lines changed: 50 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,12 @@
3
3
4
4
# uuid-php
5
5
6
-
A small PHP class for generating [RFC 4122][RFC 4122] version 3, 4, and 5 universally unique identifiers (UUID). Additionally supports [draft][draft 04] versions 6and 7.
6
+
A small PHP class for generating [RFC 4122][RFC 4122] version 3, 4, and 5 universally unique identifiers (UUID). Additionally supports [draft][draft] versions 6, 7, and 8.
7
7
8
8
If all you want is a unique ID, you should call `uuid4()`.
9
9
10
+
> Implementations SHOULD utilize UUID version 7 over UUID version 1 and 6 if possible.
11
+
10
12
## Minimal UUID v4 implementation
11
13
12
14
Credits go to [this answer][stackoverflow uuid4] on Stackoverflow for this minimal RFC 4122 compliant solution.
@@ -25,7 +27,7 @@ echo uuid4();
25
27
26
28
## Installation
27
29
28
-
If you need comparison tools or sortable identifiers like in versions 6and 7, you might find this small and fast package useful. It doesn't require any other dependencies.
30
+
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.
-`unix_ts_ms`: 48 bit big-endian unsigned number of Unix epoch timestamp with millisecond level of precision
142
-
-`ver`: The 4 bit UUIDv7 version (0111)
185
+
-`ver`: The 4 bit UUIDv8 version (1000)
143
186
-`subsec`: 12 bits allocated to sub-second precision values
144
187
-`var`: 2 bit UUID variant (10)
145
188
-`sub`: 2 bits allocated to sub-second precision values
146
189
-`rand`: The remaining 60 bits are filled with pseudo-random data
147
190
148
-
14 bits dedicated to sub-second precision provide 100 nanosecond resolution. The `unix_ts` and `subsec` fields guarantee the order of UUIDs generated within the same timestamp by monotonically incrementing the timer.
191
+
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.
0 commit comments