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

Abandoned → [not-empty/ulid-php-lib](/?search=not-empty%2Fulid-php-lib)Library[Utility &amp; Helpers](/categories/utility)

kiwfy/ulid-php
==============

PHP Universally Unique Lexicographically Sortable Identifier (ULID)

8.0.1(3mo ago)2112.8k↓88.9%31GPL-3.0-onlyPHPPHP ^8.4CI passing

Since Oct 17Pushed 3mo agoCompare

[ Source](https://github.com/not-empty/ulid-php-lib)[ Packagist](https://packagist.org/packages/kiwfy/ulid-php)[ RSS](/packages/kiwfy-ulid-php/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (9)Dependencies (4)Versions (11)Used By (1)

PHP Universally Unique Lexicographically Sortable Identifier (ULID)
===================================================================

[](#php-universally-unique-lexicographically-sortable-identifier-ulid)

[![Latest Version](https://camo.githubusercontent.com/a6278843a9b6e90653ec61e13721b6790ae63b31b3d3d2f1e4d84dcdc42855a8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6e6f742d656d7074792f756c69642d7068702d6c69622e7376673f7374796c653d666c61742d737175617265)](https://github.com/not-empty/ulid-php-lib/releases)[![codecov](https://camo.githubusercontent.com/27cb479bcfe2abab591d49b56e9bc14c6943c6a173061ec315afd868e90781e4/68747470733a2f2f636f6465636f762e696f2f67682f6e6f742d656d7074792f756c69642d7068702d6c69622f67726170682f62616467652e7376673f746f6b656e3d41454d56313633555736)](https://codecov.io/gh/not-empty/ulid-php-lib)[![CI Build](https://camo.githubusercontent.com/28e57561fda6eac5ea26f38b4004a4d390136b4dc82829586ff960e34490ba51/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e6f742d656d7074792f756c69642d7068702d6c69622f7068702e796d6c)](https://github.com/not-empty/ulid-php-lib/actions/workflows/php.yml)[![Downloads Old](https://camo.githubusercontent.com/3dacc289cbf10ca8538fb1ce76af58cd6afab5979fd935e50e613f47326c4a9f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b697766792f756c69642d7068703f6c6f676f3d6f6c64266c6162656c3d646f776e6c6f6164732532306c6567616379)](https://packagist.org/packages/kiwfy/ulid-php)[![Downloads](https://camo.githubusercontent.com/5e148c47850a16650717d0f4ed5c3ab2fbcf5ef747bcff6ef20cad8c008a22c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f742d656d7074792f756c69642d7068702d6c69623f6c6f676f3d6f6c64266c6162656c3d646f776e6c6f616473)](https://packagist.org/packages/not-empty/ulid-php-lib)[![PRs Welcome](https://camo.githubusercontent.com/25b3e6d0d42c98de74a98cbb4d149a1c09020cf6d1361993b72d7d5b8ffed363/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](http://makeapullrequest.com)[![Packagist License (custom server)](https://camo.githubusercontent.com/06c19ca24804f015378a77f9ca92016008218fa5833a7549d2d4f311b8ec9109/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e6f742d656d7074792f756c69642d7068702d6c6962)](https://github.com/not-empty/ulid-php-lib/blob/master/LICENSE)

PHP library to create a ULID unique identifier value

### Installation

[](#installation)

[Release 8.0.0](https://github.com/not-empty/ulid-php-lib/releases/tag/8.0.0) Requires [PHP](https://php.net) 8.4

[Release 7.0.0](https://github.com/not-empty/ulid-php-lib/releases/tag/7.0.0) Requires [PHP](https://php.net) 8.3

[Release 6.0.0](https://github.com/not-empty/ulid-php-lib/releases/tag/6.0.0) Requires [PHP](https://php.net) 8.2

[Release 5.0.0](https://github.com/not-empty/ulid-php-lib/releases/tag/5.0.0) Requires [PHP](https://php.net) 8.1

[Release 4.0.0](https://github.com/not-empty/ulid-php-lib/releases/tag/4.0.0) Requires [PHP](https://php.net) 7.4

[Release 3.0.0](https://github.com/not-empty/ulid-php-lib/releases/tag/3.0.0) Requires [PHP](https://php.net) 7.3

[Release 2.0.0](https://github.com/not-empty/ulid-php-lib/releases/tag/2.0.0) Requires [PHP](https://php.net) 7.2

[Release 1.0.0](https://github.com/not-empty/ulid-php-lib/releases/tag/1.0.0) Requires [PHP](https://php.net) 7.1

The recommended way to install is through [Composer](https://getcomposer.org/).

```
composer require not-empty/ulid-php-lib
```

### Usage

[](#usage)

Generate an Ulid

```
use Ulid\Ulid;
$ulid = new Ulid();
$ulidFromNow = $ulid->generate();
echo $ulidFromNow;
```

Generate an Ulid from a timestamp

```
use Ulid\Ulid;
$ulid = new Ulid();
$ulidFromTime = $ulid->generate(1585083964945);
echo $ulidFromTime;
```

Validates if is a valid Ulid from a string

```
use Ulid\Ulid;
$ulid = new Ulid();
$invalid = $ulid->isValidFormat('1585083964945');
var_dump($invalid)
```

Recover timestamp from Ulid

```
use Ulid\Ulid;
$ulid = new Ulid();
$timeFromUlid = $ulid->getTimeFromUlid('01E48SD97BMWHAW82D229T0C7K');
echo $timeFromUlid;
```

Recover date from Ulid

```
use Ulid\Ulid;
$ulid = new Ulid();
$dateFromUlid = $ulid->getDateFromUlid('01E48SD97BMWHAW82D229T0C7K');
echo $dateFromUlid;
```

Recover randomness from Ulid

```
use Ulid\Ulid;
$ulid = new Ulid();
$randomnessFromUlid = $ulid->getRandomnessFromString('01E475VQGHNW990PVHXFDT4C6R');
echo $randomnessFromUlid;
```

if you want an environment to run or test it, you can build and install dependences like this

```
docker build --build-arg PHP_VERSION=8.4-cli -t not-empty/ulid-php-lib:php84 -f contrib/Dockerfile .
```

Access the container

```
docker run -v ${PWD}/:/var/www/html -it not-empty/ulid-php-lib:php84 bash
```

Verify if all dependencies is installed

```
composer install --no-dev --prefer-dist
```

and run

```
php sample/ulid-sample.php
```

### Development

[](#development)

Want to contribute? Great!

The project using a simple code. Make a change in your file and be careful with your updates! **Any new code will only be accepted with all validations.**

To ensure that the entire project is fine:

First you need to building a correct environment to install all dependences

```
docker build --build-arg PHP_VERSION=8.4-cli -t not-empty/ulid-php-lib:php84 -f contrib/Dockerfile .
```

Access the container

```
docker run --name ulid-php-lib -v ${PWD}/:/var/www/html -it not-empty/ulid-php-lib:php84 bash
```

Install all dependences

```
composer install --dev --prefer-dist
```

Run all validations

```
composer check
```

**Not Empty Foundation - Free codes, full minds**

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance79

Regular maintenance activity

Popularity31

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 73.8% 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 ~104 days

Recently: every ~206 days

Total

9

Last Release

112d ago

Major Versions

3.0.0 → 5.0.02023-10-25

2.0.0 → 4.0.02023-10-25

4.0.0 → 6.0.02023-10-25

6.0.0 → 7.0.02023-11-26

7.0.0 → 8.0.02025-12-17

PHP version history (8 changes)1.0.0PHP ^7.1

3.0.0PHP ^7.3

5.0.0PHP ^8.1

2.0.0PHP ^7.2

4.0.0PHP ^7.4

6.0.0PHP ^8.2

7.0.0PHP ^8.3

8.0.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a8e537dba9018eff457d477dba8f79158989b41ca86bd74d1c4a1186c158caa?d=identicon)[kiwfy](/maintainers/kiwfy)

---

Top Contributors

[![leodisarli](https://avatars.githubusercontent.com/u/1638455?v=4)](https://github.com/leodisarli "leodisarli (31 commits)")[![espositovitor](https://avatars.githubusercontent.com/u/26362498?v=4)](https://github.com/espositovitor "espositovitor (7 commits)")[![RafaJEstabile](https://avatars.githubusercontent.com/u/149419100?v=4)](https://github.com/RafaJEstabile "RafaJEstabile (2 commits)")[![brunavitoria](https://avatars.githubusercontent.com/u/43785466?v=4)](https://github.com/brunavitoria "brunavitoria (1 commits)")[![JhonatanEstabile](https://avatars.githubusercontent.com/u/40630775?v=4)](https://github.com/JhonatanEstabile "JhonatanEstabile (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[joy2362/php-time-zone

A simple package that provide list of all timezone that php support

162.0k](/packages/joy2362-php-time-zone)[hashandsalt/kirby3-seo

Kirby 3 - SEO tools

103.8k](/packages/hashandsalt-kirby3-seo)

PHPackages © 2026

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