PHPackages                             oittaa/uuid - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. oittaa/uuid

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

oittaa/uuid
===========

A small PHP class for generating RFC 9562 universally unique identifiers (UUID) from version 3 to version 8.

1.10(1y ago)50302.7k↓20.9%13[4 PRs](https://github.com/oittaa/uuid-php/pulls)5MITPHPPHP ^8.1CI passing

Since Nov 4Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/oittaa/uuid-php)[ Packagist](https://packagist.org/packages/oittaa/uuid)[ RSS](/packages/oittaa-uuid/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (14)Used By (5)

[![CI](https://github.com/oittaa/uuid-php/actions/workflows/main.yml/badge.svg)](https://github.com/oittaa/uuid-php/actions/workflows/main.yml)[![codecov](https://camo.githubusercontent.com/29aaa77fb37893cda3d71a72bcdca1a55b0ac8ec7e7d4a87cc19d672757d063e/68747470733a2f2f636f6465636f762e696f2f67682f6f69747461612f757569642d7068702f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d545a494c564f53554b4d)](https://codecov.io/gh/oittaa/uuid-php)

uuid-php
========

[](#uuid-php)

A small PHP class for generating [RFC 9562](https://datatracker.ietf.org/doc/rfc9562/) 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
------------------------------

[](#minimal-uuid-v4-implementation)

Credits go to [this answer](https://stackoverflow.com/a/15875555) on Stackoverflow for this minimal RFC 9562 compliant solution.

```
