New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

saade/laravel-uuid

A small package for adding UUIDs to Eloquent models.
6,006

Larablocks Analysis

saade/laravel-uuid works with Laravel 9 to 12 (latest release v2.0.1, Feb 28, 2025).

Recommendation checks

Use with care

Use with care: meets 0 of 4 checks.

  • Latest release doesn't support Laravel 13, the current version
  • No release in the last 12 months (last: Feb 28, 2025)
  • 0 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Quiet
  • Last stable release: Feb 28, 2025.
  • No releases in the last 12 months.
  • First released: Feb 28, 2025.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.

Install
composer require saade/laravel-uuid
Latest Version:v2.0.1
PHP:^8.0
Laravel:9 – 12
License:MIT
Last Updated:Feb 28, 2025
Links: GitHub  ·  Packagist
Maintainer: saade

A small package for adding UUIDs to Eloquent models.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

[!CAUTION] This package is a fork of saade/laravel-uuid (which is no longer maintained) to keep old projects still alive.

Laravel now has first-party support for generating UUIDs and ULIDs on Eloquent models, you should use that instead.

This package will not receive any new features or updates, only compatibility fixes.

Installation

You can install the package via composer:

composer require saade/laravel-uuid

Usage

There are 2 methods for applying automatic UUID generation to your models:

1. Applying a trait

Add the Saade\Uuid\Concerns\HasUuid trait to your model:

class Post extends Model
{
    use \Saade\Uuid\Concerns\HasUuid;
}

This will automatically assign a time-ordered UUID to the uuid column on your model. UUIDs are generated using the Str::orderedUuid() method provided by Laravel.

If you wish to change the column that is used, you can define a uuidColumn method on your model:

class Post extends Model
{
    use \Saade\Uuid\Concerns\HasUuid;

    public function uuidColumn(): string
    {
        return 'guid';
    }
}
findByUuid & findByUuidOrFail

You can use the Model::findByUuid and Model::findByUuidOrFail methods to quickly retrieve a model from it's UUID. These behave the same way as Model::find and Model::findOrFail.

2. Mass-registration in ServiceProvider

If you want to use the defaults and would like to avoid adding more traits to your model, you can mass-register your models in the boot method of a ServiceProvider.

use Saade\Uuid\Uuid;

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        Uuid::generateFor([
            \App\Models\Post::class,
        ]);
    }
}

Using the UUID in route definitions

If you want to use your uuid column as the default route-model binding column, you can implement the Saade\Uuid\Contracts\WithUuidRouteKey contract on your model.

This will force the HasUuid trait to use the uuid column as the return value of getRouteKeyName which Laravel uses to determine how to receive a model for implicit route-model binding.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

saade/filament-timeline

This is my package filament-timeline

3,751 2
saade/z-api-php-sdk

This is my package z-api-php-sdk

3,483 1
saade/filament-extra

A set of reusable Filament helpers, columns, fields, actions and more!

1,037 31
saade/cep-php

Async, high availability brazilian CEP finder with multiple providers for redund...

8,252 7
saade/filament-fullcalendar

The Most Popular JavaScript Calendar integrated with Filament 💛

1,392,985 424

Version History

Version Released PHP Laravel License
v2.0.1 ^8.0 ^9.0|^10.0|^11.0|^12.0 MIT