PHPackages                             bethinkpl/laravel-model-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. bethinkpl/laravel-model-uuid

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

bethinkpl/laravel-model-uuid
============================

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

v1.0.0(3y ago)03.9kMITPHPPHP ^7.3|^8.0

Since Jan 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/bethinkpl/laravel-model-uuid)[ Packagist](https://packagist.org/packages/bethinkpl/laravel-model-uuid)[ RSS](/packages/bethinkpl-laravel-model-uuid/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (8)Versions (3)Used By (0)

Laravel Model UUIDs
===================

[](#laravel-model-uuids)

[![Build Status](https://github.com/michaeldyrynda/laravel-model-uuid/workflows/run-tests/badge.svg)](https://github.com/michaeldyrynda/laravel-model-uuid/actions?query=workflow%3Arun-tests)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/676def56f74cb37261b36ffec698c3c8531c6ae32c93488eac78aad24e95d19c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d69636861656c647972796e64612f6c61726176656c2d6d6f64656c2d757569642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/michaeldyrynda/laravel-model-uuid/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/ed5aee7e2e118d53815e70e10e4facfacb6483a9a6fa98ebf5e5f55fd3df96fa/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d69636861656c647972796e64612f6c61726176656c2d6d6f64656c2d757569642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/michaeldyrynda/laravel-model-uuid/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/6b853008b30d911f333596b5927ded2c9143e3578cc3a5242c0ab1bdce2bbc51/68747470733a2f2f706f7365722e707567782e6f72672f647972796e64612f6c61726176656c2d6d6f64656c2d757569642f762f737461626c65)](https://packagist.org/packages/dyrynda/laravel-model-uuid)[![Total Downloads](https://camo.githubusercontent.com/05ee9e0919b49f45081b056c0191c8d36cdca2e472806b92ba7b1ad6b83655ec/68747470733a2f2f706f7365722e707567782e6f72672f647972796e64612f6c61726176656c2d6d6f64656c2d757569642f646f776e6c6f616473)](https://packagist.org/packages/dyrynda/laravel-model-uuid)[![License](https://camo.githubusercontent.com/12f749f21dd48fc2e826c94a448fce4bd455d698a790465e4f42c1cc4387e58f/68747470733a2f2f706f7365722e707567782e6f72672f647972796e64612f6c61726176656c2d6d6f64656c2d757569642f6c6963656e7365)](https://packagist.org/packages/dyrynda/laravel-model-uuid)[![Dependency Status](https://camo.githubusercontent.com/5ad7042c96b04f8ca717f29641fecb9bfc6798b54f0f10327c0a1fa28da3e136/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f647972796e64613a6c61726176656c2d6d6f64656c2d757569642f6465762d6d61737465722f62616467653f7374796c653d666c61742d737175617265)](https://www.versioneye.com/php/dyrynda:laravel-model-uuid/dev-master)[![Buy us a tree](https://camo.githubusercontent.com/130148911f548b001b2ac68a32c0a06559977ca60ada3bf480c72ae4ea093175/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54726565776172652d2546302539462538432542332d6c69676874677265656e)](https://plant.treeware.earth/michaeldyrynda/laravel-model-uuid)

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

[](#introduction)

I find myself using UUID across multiple projects of late, and packaged up this functionality rather than copying and pasting it from project to project.

**Note**: this package explicitly does not disable auto-incrementing on your Eloquent models. In terms of database indexing, it is generally more efficient to use auto-incrementing integers for your internal querying. Indexing your `uuid` column will make lookups against that column fast, without impacting queries between related models.

For more information, check out [this post](https://www.percona.com/blog/2014/12/19/store-uuid-optimized-way/) on storing and working with UUID in an optimised manner.

Take a look at [laravel-efficient-uuid](https://github.com/michaeldyrynda/laravel-efficient-uuid) if you want to make it easy to generate migrations that efficiently store UUID in your database.

If you require compatibility with `ramsey/uuid` &gt;= 4.1, please use version &gt;= 6.2.0 of this package.

As of version 6.2.0, this package supports only UUID versions 1 (`uuid1`), 4 (`uuid4`), 6 (`uuid6` - ordered) and `ordered` ([Laravels ordered UUID v4](https://laravel.com/docs/master/helpers#method-str-ordered-uuid)).

Code Samples
------------

[](#code-samples)

In order to use this package, you simply need to import and use the trait within your Eloquent models.

```
