continuum-digital/uid

Laravel package to generate unique identifiers
1,921
Install
composer require continuum-digital/uid
Latest Version:0.0.1
PHP:^7.1
License:MIT
Last Updated:Aug 23, 2018
Links: GitHub  ·  Packagist
Maintainer: davidianbonner

Continuum Agency Uid

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 uid during the creating event

Notes

This package use HashIds under the hood.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

631,580,251 9,707
laravel/framework

The Laravel Framework.

580,311,802 34,925
laravel/tinker

Powerful REPL for the Laravel framework.

489,754,436 7,444
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

404,034,618 608
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

384,821,166 4,658