PHPackages                             cleaniquecoders/laravel-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. cleaniquecoders/laravel-uuid

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

cleaniquecoders/laravel-uuid
============================

Use UUID for your Laravel application.

3.1.0(3y ago)39.7k1[1 PRs](https://github.com/cleaniquecoders/laravel-uuid/pulls)2MITPHPPHP ^8.0|^8.1|^8.2CI passing

Since Mar 24Pushed 1mo agoCompare

[ Source](https://github.com/cleaniquecoders/laravel-uuid)[ Packagist](https://packagist.org/packages/cleaniquecoders/laravel-uuid)[ GitHub Sponsors](https://github.com/cleaniquecoders)[ RSS](/packages/cleaniquecoders-laravel-uuid/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (7)Versions (9)Used By (2)

[![Latest Stable Version](https://camo.githubusercontent.com/f00000bd4f85ce7f70fe2236019736ef3cd07825d74e95616005f25f32aea08f/68747470733a2f2f706f7365722e707567782e6f72672f636c65616e69717565636f646572732f6c61726176656c2d757569642f762f737461626c65)](https://packagist.org/packages/cleaniquecoders/laravel-uuid) [![Total Downloads](https://camo.githubusercontent.com/43df71a7102b73fe4867b9d3654a4ac9b8614e01497828493f438463cc0622f1/68747470733a2f2f706f7365722e707567782e6f72672f636c65616e69717565636f646572732f6c61726176656c2d757569642f646f776e6c6f616473)](https://packagist.org/packages/cleaniquecoders/laravel-uuid) [![License](https://camo.githubusercontent.com/c9c6972598be2b82eba3d842ece0c5bdb388a182fe849be85de3ca83a6cc240b/68747470733a2f2f706f7365722e707567782e6f72672f636c65616e69717565636f646572732f6c61726176656c2d757569642f6c6963656e7365)](https://packagist.org/packages/cleaniquecoders/laravel-uuid)

Laravel Uuid
------------

[](#laravel-uuid)

This package allows you to use UUID as primary key.

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

[](#installation)

In order to install `cleaniquecoders/laravel-uuid` in your Laravel project, just run the *composer require* command from your terminal:

```
$ composer require cleaniquecoders/laravel-uuid

```

Usage
-----

[](#usage)

First, you need to define in your migration the uuid field you want to use:

```
$table->uuid('uuid')->default('-');
```

Configure your model to include `\CleaniqueCoders\LaravelUuid\Traits HasUuid` trait and implement `\CleaniqueCoders\LaravelUuid\Contracts\HasUuid` contract.

```
use Illuminate\Database\Eloquent\Model;
use CleaniqueCoders\LaravelUuid\Contracts\HasUuid as HasUuidContract;
use CleaniqueCoders\LaravelUuid\Traits\HasUuid;

class User extends Model implements HasUuidContract
{
    use HasUuid;
}
```

By using the trait, you are able to use `uuid($uuid)` scope. Additional setup, you may want to define `protected $uuid_column = 'user_uuid'` if you have different UUID column name.

```
$user = User::uuid($uuid)->first();
```

Next, you can use `\CleaniqueCoders\LaravelUuid\Observers\UuidObserver` to automatically set the `uuid` value for you before save into database. You need to register in the `App\Providers\AppServiceProvider` in `boot` method:

```
use CleaniqueCoders\LaravelUuid\Observers\UuidObserver;
use App\User;
...
public function boot()
{
    User::observe(UuidObserver::class);
}
```

Alternatively, you can utilise the [Laravel Observer](https://github.com/cleaniquecoders/laravel-observers) package.

Test
----

[](#test)

Run the following command:

```
$ vendor/bin/phpunit  --testdox --verbose

```

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

[](#contributing)

Thank you for considering contributing to the `cleaniquecoders/laravel-uuid`!

### Bug Reports

[](#bug-reports)

To encourage active collaboration, it is strongly encourages pull requests, not just bug reports. "Bug reports" may also be sent in the form of a pull request containing a failing test.

However, if you file a bug report, your issue should contain a title and a clear description of the issue. You should also include as much relevant information as possible and a code sample that demonstrates the issue. The goal of a bug report is to make it easy for yourself - and others - to replicate the bug and develop a fix.

Remember, bug reports are created in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the bug report will automatically see any activity or that others will jump to fix it. Creating a bug report serves to help yourself and others start on the path of fixing the problem.

Coding Style
------------

[](#coding-style)

`cleaniquecoders/laravel-uuid` follows the PSR-2 coding standard and the PSR-4 autoloading standard.

You may use PHP CS Fixer in order to keep things standardised. PHP CS Fixer configuration can be found in `.php_cs`.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance60

Regular maintenance activity

Popularity26

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~310 days

Recently: every ~423 days

Total

7

Last Release

377d ago

Major Versions

v1.0.0 → v2.0.02020-03-24

v2.1.0 → 3.0.02022-02-12

PHP version history (5 changes)v1.0.0PHP &gt;=7.3

3.0.0PHP ^8.0|^8.1

3.1.0PHP ^8.0|^8.1|^8.2

v2.2.0PHP ^8.1 | ^8.2 | ^8.3

2.3.0PHP ^8.1 | ^8.2 | ^8.3 | ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/b57069d0f4b634f65eccc6e5d5848990e25968d45ec2cf46d626c6a4658f944b?d=identicon)[nasrulhazim.m](/maintainers/nasrulhazim.m)

---

Top Contributors

[![nasrulhazim](https://avatars.githubusercontent.com/u/10341422?v=4)](https://github.com/nasrulhazim "nasrulhazim (35 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (21 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (17 commits)")

---

Tags

laravelpackageuuid

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/cleaniquecoders-laravel-uuid/health.svg)

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

###  Alternatives

[webpatser/laravel-uuid

Laravel integration for webpatser/uuid - High-performance drop-in UUID replacements (15% faster than Ramsey). Provides Str macros, HasUuids trait, facades, and casts. RFC 4122/9562 compliant.

1.8k17.3M129](/packages/webpatser-laravel-uuid)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)[gallib/laravel-short-url

A Laravel package to shorten urls

16516.4k](/packages/gallib-laravel-short-url)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)[tehwave/laravel-achievements

Simple, elegant Achievements the Laravel way

7012.8k](/packages/tehwave-laravel-achievements)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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