Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2021-01-04 (1 month ago)  | | Not yet rated by the users | | Total: 68 | | All time: 9,784 This week: 342 |
|
Description | | Author |
This class can generate unique identifiers according to RFC 4122.
It can generate strings with unique values implementing the RFC 4122 specification in several variants. Currently it can generate:
- Variant 1 using a time based node value
- Variant 4 completely random
- Variant 3 or 5 based on a prefix and a type of identifier to generate | |
 |
|
Innovation award
 Nominee: 1x |
|
Details
UUID

UUID (v1, v3-v5) Generator (RFC4122)
Prerequisites
Language: PHP 7.1/+
Installation
composer require abmmhasan/uuid
Usage
v1
/
* Get v1 UUID (Time based)
*/
\AbmmHasan\Uuid::v1();
/
* Get generated node, for further use
*/
$node = \AbmmHasan\Uuid::getNode();
/
* Pass your pre-generated node (for node specific UUID)
*/
\AbmmHasan\Uuid::v1($node);
v4
/
* Get v4 UUID (completely random)
*/
\AbmmHasan\Uuid::v4();
v3 & v5
/
* Get v3 or v5 UUID for 'TestString' (default X500 namespace)
*/
\AbmmHasan\Uuid::v3('TestString');
// or
\AbmmHasan\Uuid::v5('TestString');
/
* Get v3 or v5 UUID for an URL & pre-defined namespace
* You can pass X500, URL, OID, DNS (check RFC4122 #Appendix C)
*/
\AbmmHasan\Uuid::v3('abmmhasan.github.io','url');
// or
\AbmmHasan\Uuid::v5('abmmhasan.github.io','url');
/
* You can generate a random UUID & use as namespace as well
*/
\AbmmHasan\Uuid::v3('abmmhasan.github.io','fa1700dd-828c-4d1b-8e6d-a6104807da90');
// or
\AbmmHasan\Uuid::v5('abmmhasan.github.io','fa1700dd-828c-4d1b-8e6d-a6104807da90');
v2
/
* Not supported!
*/
Support
Having trouble? Create an issue!
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.