slivka-b / laravel-uuid
[fork] The package provides UUID keys functionality for Eloquent models with one single trait.
Requires
- php: ^8.1
- illuminate/database: ^6.0|^7.0|^8.0|^9.0|^10.0
- ramsey/uuid: ^3.7|^4.7
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- orchestra/testbench: ^4.0|^5.0|^6.0
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2025-03-21 18:08:17 UTC
README
This package is a fork of nevadskiy/laravel-uuid.
The package provides UUID keys functionality for Eloquent models with one single trait.
More about using UUID as primary keys.
Usage
Add a trait to your model, and it will automatically set the UUID during model creation.
<?php namespace App; use Illuminate\Database\Eloquent\Model; use Nevadskiy\Uuid\Uuid; class Book extends Model { use Uuid; }
Update your migrations to specify UUID type for a primary key.
Schema::create('books', function (Blueprint $table) { $table->uuid('id')->primary(); });
Installation
Install a package via composer.
composer require imcity-tech/laravel-uuid
Requirements
- Laravel
9.0
or newer - PHP
8.0
or newer
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Any contribution is Welcome.
Please see CONTRIBUTING for more information.
Security
If you discover any security related issues, please e-mail me instead of using the issue tracker.
License
The MIT License (MIT). Please see LICENSE for more information.