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

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

floor9design/laravel-casts-uuid
===============================

A class for casting ramsey/uuid into laravel models

1.1.1(3y ago)05.1kMITPHPPHP &gt;=8.0CI failing

Since Jun 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/floor9design-ltd/laravel-casts-uuid)[ Packagist](https://packagist.org/packages/floor9design/laravel-casts-uuid)[ Docs](https://github.com/floor9design-ltd/laravel-casts-uuid)[ RSS](/packages/floor9design-laravel-casts-uuid/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

laravel-casts-uuid
==================

[](#laravel-casts-uuid)

[![Latest Version](https://camo.githubusercontent.com/5c22f6b1dc84915508d6af03c8277a68f144c496e3bddcaf6af5dcbcd533dfea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f666c6f6f723964657369676e2d6c74642f6c61726176656c2d63617374732d757569643f696e636c7564655f70726572656c6561736573267374796c653d706c6173746963)](https://github.com/floor9design-ltd/laravel-casts-uuid)[![Software License](https://camo.githubusercontent.com/10955426da15c7ed27f262e19d2eddeb65055494880cc858e8fc0792d5e15d1c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d706c6173746963)](LICENCE.md)

[![Build Status](https://camo.githubusercontent.com/6758606a821ad5c50aed0a3d91a94ac255d3c34bf12cb5664073cdab6d67c394/68747470733a2f2f7472617669732d63692e636f6d2f666c6f6f723964657369676e2d6c74642f6c61726176656c2d63617374732d757569642e7376673f746f6b656e3d78344d4678644478616b6a61556b32384a53754c)](https://travis-ci.com/github/floor9design-ltd/laravel-casts-uuid)[![Build Status](https://camo.githubusercontent.com/18aac0eb1fc293d213bfa7c1783fa249590be2c50e94ba8fe4a2ed5fda8a3834/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f666c6f6f723964657369676e2d6c74642f6c61726176656c2d63617374732d757569643f7374796c653d706c6173746963)](https://codecov.io/gh/floor9design-ltd/laravel-casts-uuid)

[![Github Downloads](https://camo.githubusercontent.com/7526fbccaf094d6c5c75a1b308004478df4c6be14df8f0c722252dbadd92c726/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f666c6f6f723964657369676e2d6c74642f6c61726176656c2d63617374732d757569642f746f74616c3f7374796c653d706c6173746963)](https://github.com/floor9design-ltd/laravel-casts-uuid)[![Packagist Downloads](https://camo.githubusercontent.com/023aa48809660a62b313331bc02831959f5bb9369e2d83449a43fdfc2aa5a9c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666c6f6f723964657369676e2f6c61726176656c2d63617374732d757569643f7374796c653d706c6173746963)](https://packagist.org/packages/floor9design/laravel-casts-uuid)

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

[](#introduction)

The Laravel Framework supports casting of types within models. This class adds the `ramsey/uuid` UUID class support for laravel models.

Install
-------

[](#install)

Add the following to the `composer.json`:

```
    "require": {
        "floor9design/laravel-casts-uuid": "^1.0",
    }

```

Setup
-----

[](#setup)

There are no specific config setup steps required. The class should autoload in PSR-4 compliant systems. If you are using the class on its own, simply include it when using a model:

```
use Floor9design\LaravelCasts\Uuid as UuidCasts;

protected $casts = [
    'uuid' => UuidCasts::class
];
```

Note the alias - often it is useful to alias the casting class as it can clash with other Uuid classes, such as the base Uuid class:

```
use Ramsey\Uuid\Uuid;

// somewhere in the code:
$uuid = Uuid::uuid4();
```

Testing
-------

[](#testing)

[![Build Status](https://camo.githubusercontent.com/ab15ecb6e3bf611058e3b79d029384c4afa2301ab2ef1e4144ac2ef80a897b67/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f666c6f6f723964657369676e2d6c74642f6c61726176656c2d63617374732d757569643f7374796c653d706c6173746963)](https://travis-ci.com/github/floor9design-ltd/laravel-casts-uuid)[![Build Status](https://camo.githubusercontent.com/18aac0eb1fc293d213bfa7c1783fa249590be2c50e94ba8fe4a2ed5fda8a3834/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f666c6f6f723964657369676e2d6c74642f6c61726176656c2d63617374732d757569643f7374796c653d706c6173746963)](https://codecov.io/gh/floor9design-ltd/laravel-casts-uuid)

Tests can be run as follows:

- `./vendor/phpunit/phpunit/phpunit`

Static analysis/code review can be performed by using [phpstan](https://phpstan.org/):

- `./vendor/bin/phpstan`

The following tests and also creates code coverage (usually maintained at 100%)

- `./vendor/phpunit/phpunit/phpunit --coverage-html docs/tests/`

Credits
-------

[](#credits)

- [Rick](https://github.com/elb98rm)

Changelog
---------

[](#changelog)

A changelog is generated here:

- [Change log](CHANGELOG.md)

License
-------

[](#license)

This software is proprietary.

- [License File](LICENCE.md)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

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

Every ~127 days

Total

3

Last Release

1182d ago

PHP version history (2 changes)1.0.0PHP &gt;=8.1

1.1.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca241b0576f1570f1de86d5cb18429e6a662cc165c1e798d321754a549d65a27?d=identicon)[elb98rm](/maintainers/elb98rm)

---

Top Contributors

[![elb98rm](https://avatars.githubusercontent.com/u/2630101?v=4)](https://github.com/elb98rm "elb98rm (106 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (56 commits)")

---

Tags

laraveluuidcastsfloor9design

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[hyn/multi-tenant

Run multiple websites using the same laravel installation while keeping tenant specific data separated for fully independant multi-domain setups.

2.6k1.1M9](/packages/hyn-multi-tenant)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[firefly-iii/data-importer

Firefly III Data Import Tool.

7545.8k](/packages/firefly-iii-data-importer)[riipandi/laravel-optikey

Use UUID, Ulid, or nanoid as optional or primary key in Laravel.

429.1k](/packages/riipandi-laravel-optikey)[elfsundae/laravel-hashid-uuid

Shorten UUID encoding for Laravel Hashid.

132.5k](/packages/elfsundae-laravel-hashid-uuid)

PHPackages © 2026

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