PHPackages                             macx/rfc-4122-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. macx/rfc-4122-uuid

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

macx/rfc-4122-uuid
==================

PHP-Class to generate valid RFC 4122 compliant Universally Unique IDentifiers (UUID) version 3, 4 and 5.

1.0.0(11y ago)47.0k1[1 issues](https://github.com/macx/rfc-4122-uuid/issues)PHPPHP &gt;=5.4.0

Since Oct 14Pushed 11y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

RFC 4122 UUID
=============

[](#rfc-4122-uuid)

The following class generates VALID RFC 4122 COMPLIANT Universally Unique IDentifiers (UUID) version 3, 4 and 5.

UUIDs generated validates using OSSP UUID Tool, and output for named-based UUIDs are exactly the same. This is a pure PHP implementation.

Author: [Andrew Moore](https://github.com/FineWolf?)posted this as a [note](http://www.php.net/manual/en/function.uniqid.php#94959) at the PHP Manual back in 2010.

Install
-------

[](#install)

If you're using [Composer](https://getcomposer.org/) as a package manager for PHP, put this require directive in your `composer.json` and run `composer install` in your CLI.

```
{
  "require" : {
    "macx/rfc-4122-uuid" : "1.0.*"
  }
}
```

Or require it via command line with:

```
$ composer require macx/rfc-4122-uuid 1.0.*
```

Generate a unique ID
--------------------

[](#generate-a-unique-id)

To generate a ID simply copy the following code:

```
include 'vendor/autoload.php';

$uuid = macx\UUID::v4();

echo 'The generated UUID is `' . $uuid . '`';
```

If you want to validate a ID against RFC do this:

```
$givenId = 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6';

if(macx\UUID::is_valid($givenId)) {
  // do something
}
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

4234d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca0101c0f351f8889e38a76e8d7d56fa11d014c16c8b53f4db40fb036e9b7f0c?d=identicon)[macx](/maintainers/macx)

---

Top Contributors

[![alfredbez](https://avatars.githubusercontent.com/u/1001186?v=4)](https://github.com/alfredbez "alfredbez (1 commits)")

---

Tags

phpuuidRFC-4122

### Embed Badge

![Health badge](/badges/macx-rfc-4122-uuid/health.svg)

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

###  Alternatives

[fab2s/souuid

Simple Ordered Uuid Generator in PHP

13573.2k1](/packages/fab2s-souuid)[sudiptpa/guid

A minimal GUID generator package for PHP.

14135.8k1](/packages/sudiptpa-guid)[sinergi/token

PHP library to generate random strings

188.7k9](/packages/sinergi-token)[wujunze/laravel-id-generate

Laravel package to generate and to validate a UUID according to the RFC 4122 standard. Only support for version 1, 3, 4 and 5 UUID are built-in. and generate number id, generate primary key

134.4k](/packages/wujunze-laravel-id-generate)

PHPackages © 2026

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