2017 © Pedro Peláez
 

library eloquent-uuid

Uuid for laravel's eloquent.

image

sleimanx2/eloquent-uuid

Uuid for laravel's eloquent.

  • Monday, March 12, 2018
  • by sleimanx2
  • Repository
  • 1 Watchers
  • 2 Stars
  • 282 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 2 % Grown

The README.md

Eloquent Uuid

Build Status, (*1)

Simple laravel / eloquent behavior to use uuid as a primary key or as a separate field by listening to Eloquent's creating event., (*2)

Usage

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

class Category extends Model
{
    use Uuid;
}

You can define the field to store the uuid in as follows (default: primary key), (*3)

protected $uuidField = 'uuid';

You can define the uuid version as follows (default: version 1), (*4)

protected $uuidVersion = 4;

currently this package only supports version 1 and 4, (*5)

Querying by Uuid, (*6)

Category::Uuid('a-uu-id');

currently this package only supports version 1 and 4, (*7)

Chosing Uuid version.

1- uuid1() generates a UUID based on the current time and the MAC address of the machine., (*8)

Pros: Useful if you want to be able to sort your UUIDs by creation time. Cons: Potential privacy leakage since it reveals which computer it was generated on and at what time. Collisions possible: If two UUIDs are generated at the exact same time (within 100 ns) on the same machine. (Or a few other unlikely marginal cases.), (*9)

2- uuid2() doesn't seem to be used anymore., (*10)

3- uuid3() generates a UUID by taking an MD5 hash of an arbitrary name that you choose within some namespace (e.g. URL, domain name, etc)., (*11)

Pros: Provides a nice way of assigning blocks of UUIDs to different namespaces. Easy to reproduce the UUID from the name. Cons: If you have a unique name already, why do you need a UUID? Collisions possible: If you reuse a name within a namespace, or if there is a hash collision., (*12)

4- uuid4() generates a completely random UUID., (*13)

Pros: No privacy concerns. Don't have to generate unique names. Cons: No structure to UUIDs. Collisions possible: If you use a bad random number generator, reuse a random seed, or are very, very unlucky., (*14)

5- uuid5() is the same as uuid3(), except using a SHA-1 hash instead of MD5. Officially preferred over uuid3()., (*15)

The Versions

12/03 2018

dev-master

9999999-dev https://github.com/sleimanx2/eloquent-uuid

Uuid for laravel's eloquent.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework uuid eloquent

12/03 2018

v1.5

1.5.0.0 https://github.com/sleimanx2/eloquent-uuid

Uuid for laravel's eloquent.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework uuid eloquent

12/03 2018

v1.4

1.4.0.0 https://github.com/sleimanx2/eloquent-uuid

Uuid for laravel's eloquent.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework uuid eloquent

09/12 2016

v1.3

1.3.0.0 https://github.com/sleimanx2/eloquent-uuid

Uuid for laravel's eloquent.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework uuid eloquent

21/10 2016

v1.2

1.2.0.0 https://github.com/sleimanx2/eloquent-uuid

Uuid for laravel's eloquent.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework uuid eloquent

29/06 2016

v1.1

1.1.0.0 https://github.com/sleimanx2/eloquent-uuid

Uuid for laravel's eloquent.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework uuid eloquent

29/06 2016

v1.0

1.0.0.0

Uuid for laravel's eloquent.

  Sources   Download

The Requires

 

The Development Requires

laravel framework uuid eloquent

23/02 2016

0.1.0

0.1.0.0

Uuid for laravel's eloquent.

  Sources   Download

The Requires

 

The Development Requires

laravel framework uuid eloquent