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

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

mauro-pinheiro/eloquent-uuid
============================

Adds support for UUID generation automatically for Models Eloquents.

2.4.0(5y ago)0326MITPHPPHP ^7.1

Since Mar 25Pushed 4y agoCompare

[ Source](https://github.com/mauro-pinheiro/eloquent-uuid)[ Packagist](https://packagist.org/packages/mauro-pinheiro/eloquent-uuid)[ Docs](https://yourapp.rocks)[ RSS](/packages/mauro-pinheiro-eloquent-uuid/feed)WikiDiscussions master Synced yesterday

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

 [![YourApp.Rocks logo](https://raw.githubusercontent.com/YourAppRocks/eloquent-uuid/master/docs/yourAppRocks-logo.png)](https://raw.githubusercontent.com/YourAppRocks/eloquent-uuid/master/docs/yourAppRocks-logo.png)

Eloquent UUID
=============

[](#eloquent-uuid)

[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/00699b7ecf2f776eeb0204a763a65f4ce1ba2ea9d56e3e8d46d58727323645bc/68747470733a2f2f7472617669732d63692e6f72672f596f7572417070526f636b732f656c6f7175656e742d757569642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/YourAppRocks/eloquent-uuid)[![Latest Stable Version](https://camo.githubusercontent.com/98953d359f1f970a1c49c71bced1ca3ba725039bdcba7ff856269740aca682ee/68747470733a2f2f706f7365722e707567782e6f72672f796f75722d6170702d726f636b732f656c6f7175656e742d757569642f762f737461626c65)](https://packagist.org/packages/your-app-rocks/eloquent-uuid)[![Total Downloads](https://camo.githubusercontent.com/e9df8b4bae7760dd18f37e1e13bb3f20154ff4c63655716975e9a3ae46bba573/68747470733a2f2f706f7365722e707567782e6f72672f796f75722d6170702d726f636b732f656c6f7175656e742d757569642f646f776e6c6f616473)](https://packagist.org/packages/your-app-rocks/eloquent-uuid)

Simple and flexible Laravel package that adds support for UUID generation automatically for any Eloquent model.

- Generate `uuid` automatically.
- Choose a custom name for the `uuid` column in your table. *(default 'uuid')*
- Choose the version of the generated uuid. *(default '4')*
- Checks for `uuid version` and `column name`. *(throws the InvalidUuidVersionException and MissingUuidColumnException exceptions)*
- Prevents update on uuid value.

### What is a UUID?

[](#what-is-a-uuid)

A universally unique identifier (UUID) is a 128-bit number used to identify information in computer systems. is a 36 character long identifier made up of 32 alphanumeric characters with four hyphens in amongst it. For example:`123E4567-E89b-12D3-A456-426655440000` containing letters and numbers. that will uniquely identify something. you can read more [here](https://en.wikipedia.org/wiki/Universally_unique_identifier).

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

[](#installation)

You can install the package via Composer:

```
composer require your-app-rocks/eloquent-uuid
```

or via `composer.json` file

```
{
    "require": {
        "your-app-rocks/eloquent-uuid": "~2"
    }
}
```

Usage
-----

[](#usage)

### Create table

[](#create-table)

Create your table with a `uuid` column. For example:

```
