PHPackages                             sleimanx2/eloquent-uuid - 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. [Framework](/categories/framework)
4. /
5. sleimanx2/eloquent-uuid

ActiveLibrary[Framework](/categories/framework)

sleimanx2/eloquent-uuid
=======================

Uuid for laravel's eloquent.

v1.5(8y ago)2313MITPHPCI failing

Since Feb 23Pushed 6y ago1 watchersCompare

[ Source](https://github.com/sleimanx2/eloquent-uuid)[ Packagist](https://packagist.org/packages/sleimanx2/eloquent-uuid)[ Docs](https://github.com/sleimanx2/eloquent-uuid)[ RSS](/packages/sleimanx2-eloquent-uuid/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (8)Used By (0)

Eloquent Uuid
=============

[](#eloquent-uuid)

[![Build Status](https://camo.githubusercontent.com/55378406a6e9eaf2e7a34c50ab53826d60dc62d6996eef20022f72325cef24ed/68747470733a2f2f7472617669732d63692e6f72672f736c65696d616e78322f656c6f7175656e742d757569642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sleimanx2/eloquent-uuid)

Simple laravel / eloquent behavior to use uuid as a primary key or as a separate field by listening to Eloquent's creating event.

Usage
-----

[](#usage)

```
use EloquentUuid\Uuid;
use Illuminate\Database\Eloquent\Model;

class Category extends Model
{
    use Uuid;
}

```

**You can define the field to store the uuid in as follows (default: primary key)**

```
protected $uuidField = 'uuid';
```

**You can define the uuid version as follows (default: version 1)**

```
protected $uuidVersion = 4;
```

currently this package only supports version 1 and 4

Querying by Uuid

```
Category::Uuid('a-uu-id');
```

currently this package only supports version 1 and 4

Chosing Uuid version.
=====================

[](#chosing-uuid-version)

**1- uuid1() generates a UUID based on the current time and the MAC address of the machine.**

Pros: Useful if you want to be able to sort your UUIDs by creation time. Cons: Potential privacy leakage since it reveals which computer it was generated on and at what time. Collisions possible: If two UUIDs are generated at the exact same time (within 100 ns) on the same machine. (Or a few other unlikely marginal cases.)

**2- uuid2() doesn't seem to be used anymore.**

**3- uuid3() generates a UUID by taking an MD5 hash of an arbitrary name that you choose within some namespace (e.g. URL, domain name, etc).**

Pros: Provides a nice way of assigning blocks of UUIDs to different namespaces. Easy to reproduce the UUID from the name. Cons: If you have a unique name already, why do you need a UUID? Collisions possible: If you reuse a name within a namespace, or if there is a hash collision.

**4- uuid4() generates a completely random UUID.**

Pros: No privacy concerns. Don't have to generate unique names. Cons: No structure to UUIDs. Collisions possible: If you use a bad random number generator, reuse a random seed, or are very, very unlucky.

**5- uuid5() is the same as uuid3(), except using a SHA-1 hash instead of MD5. Officially preferred over uuid3().**

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~124 days

Recently: every ~155 days

Total

7

Last Release

2990d ago

Major Versions

0.1.0 → v1.02016-06-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/5bac404ade62f4b12588587dbf602e0ddd19aea41276e218b4de716a13c20ce8?d=identicon)[sleimanx2](/maintainers/sleimanx2)

---

Top Contributors

[![sleimanx2](https://avatars.githubusercontent.com/u/5547347?v=4)](https://github.com/sleimanx2 "sleimanx2 (14 commits)")

---

Tags

frameworklaraveleloquentuuid

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sleimanx2-eloquent-uuid/health.svg)

```
[![Health](https://phpackages.com/badges/sleimanx2-eloquent-uuid/health.svg)](https://phpackages.com/packages/sleimanx2-eloquent-uuid)
```

###  Alternatives

[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[defstudio/pest-plugin-laravel-expectations

A plugin to add laravel tailored expectations to Pest

98548.9k4](/packages/defstudio-pest-plugin-laravel-expectations)[avored/framework

This is my package framework

7816.5k6](/packages/avored-framework)

PHPackages © 2026

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