PHPackages                             phpgt/ulid - 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. phpgt/ulid

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

phpgt/ulid
==========

Unique, lexicographically sortable identifiers.

v1.2.2(2mo ago)02.9k↑1126.7%[1 issues](https://github.com/PhpGt/Ulid/issues)[3 PRs](https://github.com/PhpGt/Ulid/pulls)3MITPHPPHP &gt;=8.1CI passing

Since May 8Pushed yesterday1 watchersCompare

[ Source](https://github.com/PhpGt/Ulid)[ Packagist](https://packagist.org/packages/phpgt/ulid)[ GitHub Sponsors](https://github.com/sponsors/PhpGt)[ RSS](/packages/phpgt-ulid/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (8)Versions (15)Used By (3)

Unique, lexicographically sortable identifiers.
===============================================

[](#unique-lexicographically-sortable-identifiers)

Create a `new Ulid()` anywhere in your application, and you have a stringable object that can be used as the primary key in a database. Ulid strings look something like `01G2J6MYN0PGC5Q21W9C` or can be prefixed with a type like `CUSTOMER_01G2J6MYN0PGC5Q21W9C`. They are cryptographically pseudo-random, and sort so that newer Ulids compare "greater than" older Ulids.

This solves the problems exposed with working with auto-incrementing integer primary keys, which are predictable and difficult to work with in distributed databases.

---

[ ![Build status](https://camo.githubusercontent.com/18e7514d06666afac409572e3153e0edc32c263797f66a5eb1ce45cd0e6d7b39/68747470733a2f2f62616467652e7374617475732e7068702e67742f756c69642d6275696c642e737667)](https://github.com/PhpGt/Ulid/actions)[ ![Code quality](https://camo.githubusercontent.com/69fb9942fa8daeeb45bb34231cd6a60ebbd20e7657128e71ffdcfbeb7006fc23/68747470733a2f2f62616467652e7374617475732e7068702e67742f756c69642d7175616c6974792e737667)](https://app.codacy.com/gh/PhpGt/Ulid)[ ![Code coverage](https://camo.githubusercontent.com/e4420898de4d8da8424bf2f9e6acf3c0ff70eef3c757c06fc50487bfc495e579/68747470733a2f2f62616467652e7374617475732e7068702e67742f756c69642d636f7665726167652e737667)](https://app.codecov.io/gh/PhpGt/Ulid)[ ![Current version](https://camo.githubusercontent.com/281ada7fe2e733f0a43157c893c7ab841ee60b97d7ce5c8d483b1385588ed4e5/68747470733a2f2f62616467652e7374617475732e7068702e67742f756c69642d76657273696f6e2e737667)](https://packagist.org/packages/PhpGt/Ulid)[ ![PHP.Gt/Ulid documentation](https://camo.githubusercontent.com/5b7573cb52ca269c407518eee86f6ddb21e9a0f2592be07bcf1f65c617e32fa6/68747470733a2f2f62616467652e7374617475732e7068702e67742f756c69642d646f63732e737667)](http://www.php.gt/ulid)Example usage:
--------------

[](#example-usage)

```
use GT\Ulid\Ulid;

$exampleDataSource->create(new Person(
	new Ulid("pet"),
	name: "Cody",
	age: 5,
));
```

Proudly sponsored by
====================

[](#proudly-sponsored-by)

[JetBrains Open Source sponsorship program](https://www.jetbrains.com/community/opensource/)

[![JetBrains logo.](https://camo.githubusercontent.com/b5639e7738c6dfae9fe3f3e20175570b7376ce2577a772e09c25c2d4f14bf86e/68747470733a2f2f7265736f75726365732e6a6574627261696e732e636f6d2f73746f726167652f70726f64756374732f636f6d70616e792f6272616e642f6c6f676f732f6a6574627261696e732e737667)](https://www.jetbrains.com/community/opensource/)

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance93

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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 ~240 days

Recently: every ~339 days

Total

7

Last Release

75d ago

Major Versions

v0.0.1 → v1.0.02022-07-01

PHP version history (2 changes)v0.0.1PHP &gt;=8.0

v1.2.2PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e42344b91ce4b91ab57875969f67a0a6a48de570a08bc65d673b06b72fd3a3f?d=identicon)[g105b](/maintainers/g105b)

---

Top Contributors

[![g105b](https://avatars.githubusercontent.com/u/358014?v=4)](https://github.com/g105b "g105b (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

no-airandomulid

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phpgt-ulid/health.svg)

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

###  Alternatives

[zf-commons/zfc-base

A set of genetic (abstract) classes which are commonly used across multiple modules.

1491.1M25](/packages/zf-commons-zfc-base)[paragonie/easy-ecc

Usabiliy Wrapper for mdanter/ecc

47702.5k13](/packages/paragonie-easy-ecc)

PHPackages © 2026

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