brokeyourbike / uid-keys
A simple drop-in solution for providing UUID and ULID support for the IDs of your Eloquent models.
Fund package maintenance!
brokeyourbike
Open Collective
Requires
- php: ^8.1
- laravel/framework: ^8.0|^9.0
- symfony/uid: ^6.0
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.4
- orchestra/testbench: ^6
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-11-20 15:01:21 UTC
README
A simple drop-in solution for providing UUID and ULID support for the IDs of your Eloquent models.
Installation
composer require brokeyourbike/uid-keys
Usage
use Illuminate\Database\Eloquent\Model; use BrokeYourBike\UidKeys\Database\Eloquent\Ulid; class ExampleModel extends Model { use Ulid; /** * The "type" of the auto-incrementing ID. * * @var string */ protected $keyType = 'string'; /** * Indicates if the IDs are auto-incrementing. * * @var bool */ public $incrementing = false; }
Inspiration
Code mainly stolen from the goldspecdigital/laravel-eloquent-uuid package.
Authors
- Ivan Stasiuk | Twitter | LinkedIn | stasi.uk