PHPackages                             juniorb2ss/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. [Database &amp; ORM](/categories/database)
4. /
5. juniorb2ss/eloquent-uuid

ActiveLibrary[Database &amp; ORM](/categories/database)

juniorb2ss/eloquent-uuid
========================

Trait to implement UUID in Eloquent ORM

1.0.1(8y ago)37.2k[1 PRs](https://github.com/juniorb2ss/EloquentUuid/pulls)MITPHPPHP ^7.0CI failing

Since Aug 7Pushed 5y agoCompare

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

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

Eloquent UUID Trait
===================

[](#eloquent-uuid-trait)

[![Build Status](https://camo.githubusercontent.com/d7973f582978e0e626d3f2031fc84492cc83f9124cbc8d13eb3b5e78120f4b62/68747470733a2f2f7472617669732d63692e6f72672f6a756e696f72623273732f456c6f7175656e74557569642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/juniorb2ss/EloquentUuid) [![Code Coverage](https://camo.githubusercontent.com/f9a4cf34cd43238a582cfffa8066b8728fec35c3164cc1aa0947e53f2cb9d4fe/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a756e696f72623273732f456c6f7175656e74557569642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/juniorb2ss/EloquentUuid/?branch=master) [![Laravel](https://camo.githubusercontent.com/14a04c4bd8077ac7c967f47322bf46d97b37fec5d504657b537eca0001322210/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e2a2d677265656e2e737667)](https://laravel.com) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/70c0637fd2cc0bb2f14699bf4e3a377b987043059cedadecb60b13785239d5d7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a756e696f72623273732f456c6f7175656e74557569642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/juniorb2ss/EloquentUuid/?branch=master) [![StyleCI](https://camo.githubusercontent.com/efeca75a35eb72f186e80e69c3903017e3e98204ce44fdc1a504fce9a89a0cc7/68747470733a2f2f7374796c6563692e696f2f7265706f732f39393630383735302f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/84957945) [![Code Climate](https://camo.githubusercontent.com/d2a76a0d2c1a970652425951abab6469a82deb08f2a6249956cd76e205ee614f/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6a756e696f72623273732f456c6f7175656e74557569642f6261646765732f6770612e737667)](https://codeclimate.com/github/juniorb2ss/EloquentUuid)

The `juniorb2ss/eloquent-uuid` provider a simple trait to implement UUID to ORM.

Install
-------

[](#install)

You can install this package via composer:

```
$ composer require juniorb2ss/eloquent-uuid~1.*
```

Eloquent Trait
--------------

[](#eloquent-trait)

```
use juniorb2ss\EloquentUuid\EloquentUuidTrait;

class User extends Authenticatable
{
    use Notifiable, EloquentUuidTrait;

    /**
    * UUID Column name used
    *
    * @var string
    * @optional
    */
    protected $uuidKey = 'uuid';
}
```

UUID Column
-----------

[](#uuid-column)

You need create new column in table model like `uuid` or custom name you can define in `uuidKey` model property

Example
-------

[](#example)

```
$fields = $request->only(['email', 'name', 'password']);
$user = User::create($fields); // Creating user with auto-inject uuid field

dump($user->toArray());

/*[
    "id" => "1"
    "uuid" => "723e4628-7c35-11e7-89b1-0242bfc0df57",
    "name" => "Magdalena Zboncak"
    "email" => "nitzsche.katherine@gulgowski.com"
  ]*/
```

Scope On UUID
-------------

[](#scope-on-uuid)

```
use App\User;

$user = (new User)->onUuid('aae5f3f1-0f22-4a8b-9291-d2a9649d1490')
                  ->firstOrFail();
```

Tests
-----

[](#tests)

```
composer run test
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Carlos Eduardo](https://github.com/juniorb2ss)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 86.4% 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 ~0 days

Total

2

Last Release

3198d ago

### Community

Maintainers

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

---

Top Contributors

[![juniorb2ss](https://avatars.githubusercontent.com/u/3980385?v=4)](https://github.com/juniorb2ss "juniorb2ss (19 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (3 commits)")

---

Tags

composereloquentlaravelormuuid

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[dyrynda/laravel-model-uuid

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

4802.8M8](/packages/dyrynda-laravel-model-uuid)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[genealabs/laravel-pivot-events

This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.

1404.9M8](/packages/genealabs-laravel-pivot-events)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[aglipanci/laravel-eloquent-case

Adds CASE statement support to Laravel Query Builder.

115157.2k](/packages/aglipanci-laravel-eloquent-case)

PHPackages © 2026

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