Laravel package to generate unique identifiers
Installs: 1 921
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/continuum-digital/uid
Requires
- php: ^7.1
- hashids/hashids: 3.0
- laravel/framework: >=5.5
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2025-10-05 03:28:04 UTC
README
Laravel package to create automatic unique nullable identifiers like u5CVsCnxyXg for your Eloquent models.
Installation
Require this package
composer require continuum-digital/uid
Usage
Configuration
Create a new entry in database.config.php to configure your uid's:
    'uid' => [
        'salt' => '', // Default ''
        'minLength' => '', // Default 0
        'alphabet' => '', // Default 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
    ],
You can remove the salt, minLength or alphabet to use default values.
Database
Add the $table->uid() in your Schemas:
Schema::create('your_table', function (Blueprint $table) {
    $table->uid();
})
Eloquent
Add the HasUid trait to your Models to add the capabilities:
- Local scope $model->uid($uid)
- Automatic generation of uidduring thecreatingevent
Notes
This package use HashIds under the hood.