2017 © Pedro Peláez
 

library laravel-uuid

Laravel UUID generator, supports version 4 UUIDs

image

alexchadwick/laravel-uuid

Laravel UUID generator, supports version 4 UUIDs

  • Monday, June 18, 2018
  • by alexchadwick
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel UUID

Laravel package to generate and validate (UUID)s according to RFC 4122 standard., (*1)

Support for version 4 currently only.., (*2)

Laravel 5.5 package auto discovery support., (*3)

Installation

Install to your project using composer by running the following command:, (*4)

composer require "alexchadwick/laravel-uuid

For Laravel 5.5, after installation you should see:, (*5)

Discovered Package: alexchadwick/laravel-uuid

Usage

To generate UUID

$uuid = (string) Uuid::generate()

OR, (*6)

$uuid = Uuid::generate()->string

To generate specific version of UUID

//generate UUIDv4
$uuid = (string) Uuid::generate(4)

OR, (*7)

//generate UUIDv4
$uuid = Uuid::uuid4(4)

Eloquent model UUID

The built in Trait "HasUuidPrimaryKey", will automatically generate a UUIDv4 and set it on the model's primary key field when creating model., (*8)

This will not affect model events since the Trait makes uses Laravel Model's bootTraits() function., (*9)

Validation

Using the Laravel validator, you can now pass the rule name "uuid" to validate UUIDs., (*10)

Laravel validator rule example, (*11)

'YOUR-UUID-FIELD' => 'uuid'

Running tests

Tests are location in ./test, run phpunit to run built test., (*12)

The Versions

18/06 2018

dev-master

9999999-dev https://github.com/alexchadwick/laravel-uuid

Laravel UUID generator, supports version 4 UUIDs

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Alexander Chadwick

18/06 2018

v1.0.0

1.0.0.0 https://github.com/alexchadwick/laravel-uuid

Laravel UUID generator, supports version 4 UUIDs

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Alexander Chadwick