PHPackages                             kissous/uuid7 - 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. kissous/uuid7

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

kissous/uuid7
=============

Lightweight, dependency-free PHP library to generate and handle time-ordered identifiers: UUIDv7 (RFC 9562) and ULID.

v1.1.1(1mo ago)11MITPHPPHP ^8.3CI passing

Since May 31Pushed 1mo agoCompare

[ Source](https://github.com/Kissous/uuid7)[ Packagist](https://packagist.org/packages/kissous/uuid7)[ Docs](https://github.com/Kissous/uuid7)[ RSS](/packages/kissous-uuid7/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (4)Versions (10)Used By (0)

uuid7
=====

[](#uuid7)

[![CI](https://github.com/Kissous/uuid7/actions/workflows/ci.yml/badge.svg)](https://github.com/Kissous/uuid7/actions/workflows/ci.yml)[![Packagist Version](https://camo.githubusercontent.com/08a291bda7a47d134dde75746403e456ff0cc0d8cd1b6a7278fca8efe14e67d6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b6973736f75732f7575696437)](https://packagist.org/packages/kissous/uuid7)[![PHP Version](https://camo.githubusercontent.com/b551cba93374ef4b1afaf33c4003570bbe3eca60d4735ad6e1df599363235836/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6b6973736f75732f7575696437)](https://packagist.org/packages/kissous/uuid7)[![License](https://camo.githubusercontent.com/b0c5b88028b80db5520007e69ae7e8ecf6e18bce8204c979203452ab44b92c29/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b6973736f75732f7575696437)](LICENSE)

Lightweight, **dependency-free** PHP library to generate and handle time-ordered identifiers: **UUIDv7 (RFC 9562)**, with **ULID** support coming next.

Built for database indexing performance: UUIDv7 values are sorted by time, which avoids B-tree index fragmentation (unlike random UUIDv4 values).

Why uuid7?
----------

[](#why-uuid7)

- **Zero dependencies** beyond the PHP standard library
- **Crypto-secure**: randomness from `random_bytes()` only
- **Time-ordered**: sequential inserts, compact B-tree indexes
- **Monotonic**: values generated by a single process within the same millisecond are strictly increasing
- **Tiny API**, focused on UUIDv7 (then ULID)
- **PHP 8.3+**: `final`, `readonly`, immutable value objects
- **RFC 9562** compliant

Installation
------------

[](#installation)

```
composer require kissous/uuid7
```

Requires PHP **8.3** or higher.

Quick start
-----------

[](#quick-start)

```
use Kissous\Uuid7\Uuid7;

// Generate a new UUIDv7
$uuid = Uuid7::generate();
echo $uuid->toString();        // e.g. 0190f3a4-7b2c-7def-8123-456789abcdef
echo $uuid;                    // same output (Stringable)

// Parse an existing string (case-insensitive, normalized to lowercase)
$parsed = Uuid7::fromString('0190F3A4-7B2C-7DEF-8123-456789ABCDEF');

// Validation: throws InvalidUuidException if the string is not a valid UUIDv7
use Kissous\Uuid7\Exception\InvalidUuidException;

try {
    Uuid7::fromString('not-a-uuid');
} catch (InvalidUuidException $e) {
    // ...
}
```

Roadmap
-------

[](#roadmap)

VersionContents**v1.0**UUIDv7: `generate`, `fromString`, `toString`, validation**v1.1**Monotonicity within the same millisecondv1.2`timestamp()`, `equals()`, `compareTo()`v1.3`toBytes/fromBytes`, `toHex/fromHex`, `toBase32/fromBase32`v1.4Full ULID support + UUIDv7 ↔ ULID conversionv1.5Injectable `Clock` / `RandomSource`, `Uuid7Factory`v1.6Integrations: `kissous/uuid7-doctrine`, `kissous/uuid7-eloquent`Per-version details in [`docs/roadmap/`](docs/roadmap/).

Development
-----------

[](#development)

```
composer install
composer test        # PHPUnit (Unit + Property)
composer stan        # PHPStan, max level
composer cs:check    # PHP-CS-Fixer (dry-run)
composer cs          # PHP-CS-Fixer (apply fixes)
composer bench       # Benchmarks against ramsey/uuid
```

License
-------

[](#license)

[MIT](LICENSE) © Omar Kissous

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance89

Actively maintained with recent releases

Popularity3

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

Every ~0 days

Total

4

Last Release

54d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20760536?v=4)[Kissous Omar](/maintainers/Kissous)[@Kissous](https://github.com/Kissous)

---

Top Contributors

[![Kissous](https://avatars.githubusercontent.com/u/20760536?v=4)](https://github.com/Kissous "Kissous (13 commits)")

---

Tags

composerguididentifierphprfc9562time-orderedulidunique-iduuiduuid7uuidv7uuididentifierguidulidrfc9562uuidv7uuid7time-ordered

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kissous-uuid7/health.svg)

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

###  Alternatives

[ramsey/uuid

A PHP library for generating and working with universally unique identifiers (UUIDs).

12.6k745.0M4.1k](/packages/ramsey-uuid)[pascaldevink/shortuuid

PHP 7.4+ library that generates concise, unambiguous, URL-safe UUIDs

5941.9M16](/packages/pascaldevink-shortuuid)[keiko/uuid-shortener

A simple shortener library for RFC 4122 compatible UUIDs. Change your 36 chars long UUID into it's shorter equivalent.

150227.4k3](/packages/keiko-uuid-shortener)[identifier/identifier

Common Interfaces and Factories for Identifiers

3233.4k1](/packages/identifier-identifier)[ramsey/identifier

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

606.9k2](/packages/ramsey-identifier)[oittaa/uuid

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

54324.8k6](/packages/oittaa-uuid)

PHPackages © 2026

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