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

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

alexchadwick/laravel-uuid
=========================

Laravel UUID generator, supports version 4 UUIDs

v1.0.0(7y ago)044MITPHPPHP ^7.0

Since Jun 18Pushed 7y ago1 watchersCompare

[ Source](https://github.com/alexchadwick/laravel-uuid)[ Packagist](https://packagist.org/packages/alexchadwick/laravel-uuid)[ Docs](https://github.com/alexchadwick/laravel-uuid)[ RSS](/packages/alexchadwick-laravel-uuid/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Laravel UUID
============

[](#laravel-uuid)

Laravel package to generate and validate (UUID)s according to RFC 4122 standard.

**Support for version 4 currently only..**

Laravel 5.5 package auto discovery support.

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

[](#installation)

Install to your project using composer by running the following command:

```
composer require "alexchadwick/laravel-uuid

```

For Laravel 5.5, after installation you should see:

```
Discovered Package: alexchadwick/laravel-uuid

```

Usage
-----

[](#usage)

#### To generate UUID

[](#to-generate-uuid)

```
$uuid = (string) Uuid::generate()
```

OR

```
$uuid = Uuid::generate()->string
```

#### To generate specific version of UUID

[](#to-generate-specific-version-of-uuid)

```
//generate UUIDv4
$uuid = (string) Uuid::generate(4)
```

OR

```
//generate UUIDv4
$uuid = Uuid::uuid4(4)
```

### Eloquent model UUID

[](#eloquent-model-uuid)

The built in Trait "HasUuidPrimaryKey", will automatically generate a UUIDv4 and set it on the model's primary key field when creating model.

This will not affect model events since the Trait makes uses Laravel Model's bootTraits() function.

Validation
----------

[](#validation)

Using the Laravel validator, you can now pass the rule name "uuid" to validate UUIDs.

Laravel validator rule example

```
'YOUR-UUID-FIELD' => 'uuid'
```

Running tests
-------------

[](#running-tests)

Tests are location in ./test, run phpunit to run built test.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2886d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/263799d4cba05f6c0dc891851849149dfe32b56faf39f61662e85c6eb5b3803b?d=identicon)[alexchadwick](/maintainers/alexchadwick)

---

Top Contributors

[![alexchadwick](https://avatars.githubusercontent.com/u/7408103?v=4)](https://github.com/alexchadwick "alexchadwick (5 commits)")

---

Tags

composer-packagelaravellaravel-package

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[magarrent/laravel-url-shortener

Simpler Url Shortener for Laravel

557.4k](/packages/magarrent-laravel-url-shortener)[binarytorch/larecipe-feedback

Get feedback from your users about your documentations.

197.8k1](/packages/binarytorch-larecipe-feedback)

PHPackages © 2026

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