PHPackages                             domainflow/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. domainflow/uuid

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

domainflow/uuid
===============

DomainFlow UUID implementation for versions 1–8, including inspection and validation utilities.

v1.0.0(1y ago)027MITPHPPHP ^8.3||^8.4CI passing

Since Apr 3Pushed 1y agoCompare

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

READMEChangelogDependencies (7)Versions (2)Used By (0)

DomainFlow Uuid
===============

[](#domainflow-uuid)

[![Tests](https://github.com/domainflow/uuid/actions/workflows/tests.yml/badge.svg)](https://github.com/domainflow/uuid/actions/workflows/tests.yml)[![Packagist Version](https://camo.githubusercontent.com/66512aa389d06c6661f6c0cb8bf9af79a61b4c8b299e38125a42cc335a8ffd43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646f6d61696e666c6f772f75756964)](https://camo.githubusercontent.com/66512aa389d06c6661f6c0cb8bf9af79a61b4c8b299e38125a42cc335a8ffd43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646f6d61696e666c6f772f75756964)[![PHP Version](https://camo.githubusercontent.com/9b599d98e80640855d6b1894fab65b860fa82ab086ad0a8a829f7618eaf8650f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f6d61696e666c6f772f75756964)](https://camo.githubusercontent.com/9b599d98e80640855d6b1894fab65b860fa82ab086ad0a8a829f7618eaf8650f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f6d61696e666c6f772f75756964)[![License](https://camo.githubusercontent.com/f836a0c8caba176e47989ad9b6af7df426f03209a76873e1d49ce66bf6a17204/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f646f6d61696e666c6f772f75756964)](https://camo.githubusercontent.com/f836a0c8caba176e47989ad9b6af7df426f03209a76873e1d49ce66bf6a17204/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f646f6d61696e666c6f772f75756964)[![PHPStan](https://camo.githubusercontent.com/70237ca9cbbd2749f729e2c3cd1c3446ffa316f600984bafcbe197d8e9a11d9b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230392d627269676874677265656e2e737667)](https://camo.githubusercontent.com/70237ca9cbbd2749f729e2c3cd1c3446ffa316f600984bafcbe197d8e9a11d9b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230392d627269676874677265656e2e737667)

A fully featured, **immutable UUID library** supporting all **RFC versions 1–8**, including validation, generation, metadata inspection, and JSON serialization.

---

✨ Highlights
------------

[](#-highlights)

- ✅ Supports all UUID versions (v1–v8)
- ✅ Immutable, `final readonly` classes
- ✅ Inspector tool for version/variant/metadata extraction

---

⚙️ Requirements
---------------

[](#️-requirements)

- **PHP 8.3+**

---

📦 Installation
--------------

[](#-installation)

```
composer require domainflow/uuid
```

---

🚀 Usage
-------

[](#-usage)

### 🔧 Generate UUIDs

[](#-generate-uuids)

```
use DomainFlow\Uuid\{UuidV1, UuidV2, UuidV3, UuidV4, UuidV5, UuidV6, UuidV7, UuidV8};

UuidV1::generate();                     // Time-based UUID (v1)
UuidV2::generate(1001, 'uid');          // DCE Security UUID (v2)
UuidV3::generate($ns, 'my-name');       // Name-based UUID with MD5 (v3)
UuidV4::generate();                     // Random UUID (v4)
UuidV5::generate($ns, 'my-name');       // Name-based UUID with SHA-1 (v5)
UuidV6::generate();                     // Time-ordered UUID (v6)
UuidV7::generate();                     // Unix timestamp UUID (v7)
UuidV8::generate();                     // Application-defined/custom UUID (v8)
```

---

### 🔍 Inspect a UUID

[](#-inspect-a-uuid)

```
use DomainFlow\Uuid\Inspector;

$inspector = Inspector::analyze('your-uuid-here');
$inspector->version();   // int (e.g. 4)
$inspector->variant();   // string (e.g. "RFC 4122")
$inspector->metadata();  // array with version-specific data
```

---

📘 Parameters Explained
----------------------

[](#-parameters-explained)

### `UuidV2::generate(int $localId, string $domain)`

[](#uuidv2generateint-localid-string-domain)

- `$localId`: Typically a UID or GID (`getmyuid()`, `getmygid()`)
- `$domain`: Either `'uid'` or `'gid'`

### `UuidV3` / `UuidV5`

[](#uuidv3--uuidv5)

```
UuidV3::generate(string $namespace, string $name);
UuidV5::generate(string $namespace, string $name);
```

- `$namespace`: A valid UUID string (e.g., DNS namespace `6ba7b810-9dad-11d1-80b4-00c04fd430c8`)
- `$name`: Any string (email, file path, identifier)

---

🔒 Trait &amp; Interface
-----------------------

[](#-trait--interface)

All UUID classes implement:

- `UuidInterface` — common contract for all versions
- `UuidMethodsTrait` — shared implementation (`equals()`, `fromString()`, `fromJson()`, etc.)

---

📄 License
---------

[](#-license)

[MIT](LICENSE)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance46

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

410d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/92f358a3839d6f81e18b53a5e04ec8bfb17c057117b9847c59281b0239b796c8?d=identicon)[42dknp](/maintainers/42dknp)

---

Top Contributors

[![42dknp](https://avatars.githubusercontent.com/u/132363982?v=4)](https://github.com/42dknp "42dknp (2 commits)")

---

Tags

php8uuiduuid-generatorphpuuididentifierimmutablerfc4122domainflow

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/domainflow-uuid/health.svg)

```
[![Health](https://phpackages.com/badges/domainflow-uuid/health.svg)](https://phpackages.com/packages/domainflow-uuid)
```

###  Alternatives

[sudiptpa/guid

A minimal GUID generator package for PHP.

14135.8k1](/packages/sudiptpa-guid)[oittaa/uuid

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

50302.7k5](/packages/oittaa-uuid)[fab2s/souuid

Simple Ordered Uuid Generator in PHP

13573.2k1](/packages/fab2s-souuid)[ramsey/identifier

A PHP library for generating and working with identifiers, including UUIDs, ULIDs, and Snowflakes

603.0k1](/packages/ramsey-identifier)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
