PHPackages                             goldspecdigital/laravel-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. goldspecdigital/laravel-eloquent-uuid

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

goldspecdigital/laravel-eloquent-uuid
=====================================

A simple drop-in solution for providing UUID support for the IDs of your Eloquent models.

v10.0.0(3y ago)5111.3M↓10.7%45[3 PRs](https://github.com/goldspecdigital/laravel-eloquent-uuid/pulls)9MITPHPPHP ^8.1CI failing

Since Jun 8Pushed 2y ago9 watchersCompare

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

READMEChangelog (10)Dependencies (3)Versions (27)Used By (9)

 [![Eloquent UUID](https://camo.githubusercontent.com/1a0460f14430f61534f96f5cd7409d6eb3fa9ac8f16c9f2b89d2ebba292bf047/68747470733a2f2f73766773686172652e636f6d2f692f4456532e737667)](https://github.com/goldspecdigital/laravel-eloquent-uuid)

 [![GitHub stars](https://camo.githubusercontent.com/84cbc38cf5737b413e8fe580f33f0e0222171d20bb7f2867a037c57468787915/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f676f6c64737065636469676974616c2f6c61726176656c2d656c6f7175656e742d757569642e7376673f7374796c653d736f6369616c)](https://github.com/goldspecdigital/laravel-eloquent-uuid)

 [![GitHub tag (latest SemVer)](https://camo.githubusercontent.com/1882a58d306703848ab8289c45340c82df3a1bbaddb8d396d472c6d7606bc2da/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f676f6c64737065636469676974616c2f6c61726176656c2d656c6f7175656e742d757569642e737667)](https://github.com/goldspecdigital/laravel-eloquent-uuid/tags) [![Build status](https://github.com/goldspecdigital/laravel-eloquent-uuid/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/goldspecdigital/laravel-eloquent-uuid/actions/workflows/tests.yml) [![Packagist](https://camo.githubusercontent.com/d6195866e856561afaad00ae7c3c4682a39d5fd3c0f8615b77b6519b9de15226/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676f6c64737065636469676974616c2f6c61726176656c2d656c6f7175656e742d757569642e737667)](https://packagist.org/packages/goldspecdigital/laravel-eloquent-uuid) [![PHP from Packagist](https://camo.githubusercontent.com/f78ca94aaf1bca1e75f4654534c8404c35340c615a5dba8615489b18cf741097/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f676f6c64737065636469676974616c2f6c61726176656c2d656c6f7175656e742d757569642e737667)](https://camo.githubusercontent.com/f78ca94aaf1bca1e75f4654534c8404c35340c615a5dba8615489b18cf741097/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f676f6c64737065636469676974616c2f6c61726176656c2d656c6f7175656e742d757569642e737667) [![Packagist](https://camo.githubusercontent.com/7ad502a5323b551d888b9e2b48d168706343f2b45c6e1a0e82f09e817afe1c2f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f676f6c64737065636469676974616c2f6c61726176656c2d656c6f7175656e742d757569642e737667)](https://camo.githubusercontent.com/7ad502a5323b551d888b9e2b48d168706343f2b45c6e1a0e82f09e817afe1c2f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f676f6c64737065636469676974616c2f6c61726176656c2d656c6f7175656e742d757569642e737667)

Introduction
------------

[](#introduction)

A simple drop-in solution for providing UUID support for the IDs of your Eloquent models.

Both `v1` and `v4` IDs are supported out of the box, however should you need `v3` or `v5` support, you can easily add this in.

Installing
----------

[](#installing)

Reference the table below for the correct version to use in conjunction with the version of Laravel you have installed:

LaravelThis package`v5.8.*``v1.*``v6.*``v6.*``v7.*``v7.*``v8.*``v8.*``v9.*``v9.*``v10.*``v10.*`You can install the package via composer:

```
composer require goldspecdigital/laravel-eloquent-uuid:^10.0
```

Usage
-----

[](#usage)

There are two ways to use this package:

1. By extending the provided model classes (preferred and simplest method).
2. By using the provided model trait (allows for extending another model class).

### Extending model

[](#extending-model)

When creating a Eloquent model, instead of extending the standard Laravel model class, extend from the model class provided by this package:

```
