kduma/eloquent-uuidable

Eloquent Uuidable Trait

Maintainers

Package info

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

pkg:composer/kduma/eloquent-uuidable

Statistics

Installs: 487

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v3.0.0 2026-04-08 14:39 UTC

This package is auto-updated.

Last update: 2026-04-08 14:42:10 UTC


README

Latest Stable Version Total Downloads License

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

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

Requirements

  • PHP ^8.3
  • Laravel ^13.0

Installation

composer require kduma/eloquent-uuidable

Usage

use KDuma\Eloquent\Uuidable;
use KDuma\Eloquent\Attributes\HasUuid;

#[HasUuid(field: 'uuid')]
class User extends Model
{
    use Uuidable;
}

Add a uuid column to your migration:

$table->uuid('uuid')->unique();

UUID is auto-generated on create. Find by UUID with User::whereUuid($uuid) or User::byUuid($uuid).

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