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

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

oanhnn/laravel-ulid
===================

A Laravel package for ULID (Universally Unique Lexicographically Sortable Identifier)

46PHP

Since Feb 21Pushed 7y ago1 watchersCompare

[ Source](https://github.com/oanhnn/laravel-ulid)[ Packagist](https://packagist.org/packages/oanhnn/laravel-ulid)[ RSS](/packages/oanhnn-laravel-ulid/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel ULID
============

[](#laravel-ulid)

[![Latest Version](https://camo.githubusercontent.com/548c8743340068866843547e7970a0b3309a5bf4b30058c60d451d36b92cd2aa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f616e686e6e2f6c61726176656c2d756c69642e737667)](https://packagist.org/packages/oanhnn/laravel-ulid)[![Software License](https://camo.githubusercontent.com/2f1934cd24e137e5023678fad38a665e0804557e35ab6af7369f372fd2adcab3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6f616e686e6e2f6c61726176656c2d756c69642e737667)](LICENSE)[![Build Status](https://camo.githubusercontent.com/8e9e7d2d1f505a51d633e41c63438ebb154f9b3bbc476389970ef98982eb71d6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6f616e686e6e2f6c61726176656c2d756c69642f6d61737465722e737667)](https://travis-ci.org/oanhnn/laravel-ulid)[![Coverage Status](https://camo.githubusercontent.com/dcdcd5137db186377d52fa4bdf9d37f692312d9bd2877390f13625a1995f0a78/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6769746875622f6f616e686e6e2f6c61726176656c2d756c69642f6d61737465722e737667)](https://coveralls.io/github/oanhnn/laravel-ulid?branch=master)[![Total Downloads](https://camo.githubusercontent.com/be82c9537fde52b03f27ed14880c20124975ea6a1ab0f5c348e924d3fb695dbc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f616e686e6e2f6c61726176656c2d756c69642e737667)](https://packagist.org/packages/oanhnn/laravel-ulid)[![Requires PHP](https://camo.githubusercontent.com/160b2ea87a653c0e7aa650a7b5595f2e837a52d966e7c82fcc680c862e3eb22d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7068702d762f6f616e686e6e2f6c61726176656c2d756c69642e737667)](https://travis-ci.org/oanhnn/laravel-ulid)

A Laravel package for ULID (Universally Unique Lexicographically Sortable Identifier).

TODO
----

[](#todo)

- Make repository on [Github](https://github.com)
- Make repository on [Travis](https://travis.org)
- Make repository on [Coveralls](https://coveralls.io)
- Make repository on [Packagist](https://packagist.org)
- Write logic classes
- Write test scripts
- Write README &amp; documents

Requirements
------------

[](#requirements)

- php &gt;=7.1.3
- Laravel 5.5+

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

[](#installation)

Begin by pulling in the package through Composer.

```
$ composer require oanhnn/laravel-ulid
```

Usage
-----

[](#usage)

To let a model make use of ULIDs, you must add a ulid field as the primary field in the table.

```
Schema::create('table_name', function (Blueprint $table) {
    $table->ulid('id');
    $table->primary('id');

    // other fields
});
```

To get your model to work with the encoded ULID (i.e. to use ulid as a primary key), you must let your model use the `Laravel\Ulid\HasUlid` trait.

```
use Illuminate\Database\Eloquent\Model;
use Laravel\Ulid\HasUlid;

class TestModel extends Model
{
    use HasUlid;

    // other logic codes
}
```

### Creating a model

[](#creating-a-model)

The UUID of a model will automatically be generated upon save.

```
$model = MyModel::create();
dump($model->getKey());
```

Changelog
---------

[](#changelog)

See all change logs in [CHANGELOG](CHANGELOG.md)

Testing
-------

[](#testing)

```
$ git clone git@github.com/oanhnn/laravel-ulid.git /path
$ cd /path
$ composer install
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email to [Oanh Nguyen](mailto:oanhnn.bk@gmail.com) instead of using the issue tracker.

Credits
-------

[](#credits)

- [Oanh Nguyen](https://github.com/oanhnn)
- [All Contributors](../../contributors)

License
-------

[](#license)

This project is released under the MIT License.
Copyright © [Oanh Nguyen](https://oanhnn.github.io).

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![oanhnn](https://avatars.githubusercontent.com/u/1757120?v=4)](https://github.com/oanhnn "oanhnn (3 commits)")

---

Tags

laravellaravel-5-packagelaravel-packageuliduuid

### Embed Badge

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

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

PHPackages © 2026

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