UUID v3, v4, v5 generator class

2.0.0 2024-09-14 18:40 UTC

This package is not auto-updated.

Last update: 2024-12-07 19:55:15 UTC


README

Universal Unique Identifier v3, v4 and v5 generator

Copyright: The PHP Documentation Group
License: Creative Commons Attribution 3.0 License

How to use

use info\synapp\tools\uuid\UUID;

require_once 'vendor/elcodedocle/uuid/uuid.php';

//Named-based UUID:
$v3uuid = UUID::v3(UUID::v4(), 'BlahBlahSomeRandomStringBlergBlorg');
$v5uuid = UUID::v5(UUID::v4(), 'BlahBlahSomeRandomStringBlergBlorg');

//Pseudo-random UUID:
$v4uuid = UUID::v4();

echo 'UUIDv3: '.$v3uuid."\n".'UUIDv4: '.$v4uuid."\n".'UUIDv5: '.$v5uuid."\n";

Motivation

I needed a UUID generator I could import as a dependency on my projects, so I took the one from the PHP manual, added a composer.json and this README.md and uploaded it to this repo.

Acks

Enjoy!