2017 © Pedro Peláez
 

library laravel-uuid

A simple library to use UUIDs as your Eloquent model's primary key.

image

kblais/laravel-uuid

A simple library to use UUIDs as your Eloquent model's primary key.

  • Thursday, October 5, 2017
  • by kblais
  • Repository
  • 1 Watchers
  • 8 Stars
  • 16,672 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 3 Versions
  • 9 % Grown

The README.md

laravel-uuid Build Status

A simple library to use UUIDs as your Eloquent model's primary key., (*1)

Why should I use UUIDs ?

To answer this question, I simply recommend you read this blog post., (*2)

OK, I'm convinced now. How do I install this ?

Require this package with Composer :, (*3)

composer require kblais/laravel-uuid
  • the package internally use ramsey/uuid to generate the UUIDs.

Usage

First, your model's column must be a 36 characters column :, (*4)

  • Laravel v4
$table->char('id', 36);
$table->primary('id');
  • Laravel v5+
$table->uuid('id');
$table->primary('id');

Then, just add the Kblais\Uuid\Uuid trait to your model, and you're done :, (*5)

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Kblais\Uuid\Uuid;

class User extends Model
{
    use Uuid;
}

Version 4 UUIDs are used by default. You can change this by overriding the $uuidVersion & $uuidString variables. For example :, (*6)

protected $uuidVersion = 1;
protected $uuidString  = ''; // only needed when $uuidVersion is "3 or 5"

The supported UUIDs versions here are "1, 3, 4 and 5"., (*7)

The Versions

05/10 2017

dev-master

9999999-dev

A simple library to use UUIDs as your Eloquent model's primary key.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Killian Blais

05/10 2017

1.0.0

1.0.0.0

A simple library to use UUIDs as your Eloquent model's primary key.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Killian Blais

02/06 2016

0.1.0

0.1.0.0

A simple library to use UUIDs as your Eloquent model's primary key.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Killian Blais