kduma/eloquent-ulidable

Eloquent Ulidable Trait

Maintainers

Package info

github.com/kduma-OSS/LV-eloquent-ulidable

pkg:composer/kduma/eloquent-ulidable

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

v3.0.0 2026-04-08 15:04 UTC

This package is auto-updated.

Last update: 2026-04-08 15:04:58 UTC


README

Latest Stable Version Total Downloads License

Eloquent trait that adds a ULID as an additional column alongside the numeric id in Laravel models.

Full documentation: opensource.duma.sh/libraries/php/eloquent-ulidable

Requirements

  • PHP ^8.3
  • Laravel ^13.0

Installation

composer require kduma/eloquent-ulidable

Usage

use KDuma\Eloquent\Ulidable;
use KDuma\Eloquent\Attributes\HasUlid;

#[HasUlid(field: 'ulid')]
class Post extends Model
{
    use Ulidable;
}

Add a ulid column to your migration:

$table->ulid()->unique();

ULID is auto-generated on create. Find by ULID with Post::whereUlid($ulid) or Post::byUlid($ulid).

Unlike Laravel's built-in HasUlids, this package keeps the numeric id as the primary key and stores the ULID in a separate column.