2017 © Pedro Peláez
 

library uuid

Laravel package to generate a UUID according to the RFC 4122 standard. UUID Versions 1, 3, 4 and 5 are supported. With MIT license.

image

jeremykenedy/uuid

Laravel package to generate a UUID according to the RFC 4122 standard. UUID Versions 1, 3, 4 and 5 are supported. With MIT license.

  • Saturday, January 20, 2018
  • by jeremykenedy
  • Repository
  • 1 Watchers
  • 9 Stars
  • 11,099 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 13 Versions
  • 27 % Grown

The README.md

Laravel Uuid (Universally unique identifier)

Total Downloads StyleCI Build Status Latest Stable Version License: MIT, (*1)

Laravel package to generate a UUID according to the RFC 4122 standard. UUID Versions 1, 3, 4 and 5 are supported. With MIT license., (*2)

About

Since Laravel 4.* and 5.* both rely on either OpenSSL or Mcrypt, the pseudo random byte generator now tries to use one of them. If both cannot be used (not a Laravel project?), the 'less random' mt_rand() function is used., (*3)

Requirements

Installation

Laravel 5.5 and above
  1. From your projects root folder in terminal run:
    composer require jeremykenedy/uuid
  • Uses package auto discovery feature, no need to edit the config/app.php file.
Laravel 5.4 and below
  1. From your projects root folder in terminal run:
    composer require jeremykenedy/uuid:2.1.2
  1. Register the package with laravel in config/app.php under aliases with the following:
    'aliases' => [
        'Uuid' => jeremykenedy\Uuid\Uuid::class,
    ];

Basic Usage

To quickly generate a UUID just do, (*4)

    Uuid::generate()
  • This will generate a version 1 with a random ganerated MAC address.

Advanced Usage

UUID creation

UUID V1

Generate a version 1, time-based, UUID. You can set the optional node to the MAC address. If not supplied it will generate a random MAC address., (*5)

Uuid::generate(1,'00:11:22:33:44:55');
UUID V3

Generate a version 3, name-based using MD5 hashing, UUID, (*6)

Uuid::generate(3,'test', Uuid::NS_DNS);
UUID V4

Generate a version 4, truly random, UUID, (*7)

Uuid::generate(4);
UUID V5

Generate a version 5, name-based using SHA-1 hashing, UUID, (*8)

Uuid::generate(5,'test', Uuid::NS_DNS);

Additional Features

Import UUID
  • To import a UUID
$uuid = Uuid::import('d3d29d70-1d25-11e3-8591-034165a3a613');
Extract Time
  • Extract the time for a time-based UUID (version 1)
$uuid = Uuid::generate(1);
dd($uuid->time);
Extract Version
  • Extract the version of an UUID

```php $uuid = Uuid::generate(4); dd($uuid->version); ````, (*9)

Changelog

2.*
  • Laravel Uuid is now fully PSR-2, just like Laravel 5.1.
  • Not that much has changed except for UPPERCASING the constants used in Laravel Uuid.
  • Meaning Uuid::nsDNS is now Uuid::NS_DNS etc. Should be an easy fix.

Credits

  • Full development credit must go to webpatser. This package was forked and modified to be compliant with MIT licensing standards for production use.

License

Laravel UUID is licensed under the MIT license for both personal and commercial products. Enjoy!, (*10)

The Versions

20/01 2018

dev-master

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

Laravel package to generate a UUID according to the RFC 4122 standard. UUID Versions 1, 3, 4 and 5 are supported. With MIT license.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Jeremy Kenedy

uuid rfc4122

04/09 2017

v3.1.0

3.1.0.0 https://github.com/jeremykenedy/laravel-uuid

Laravel package to generate a UUID according to the RFC 4122 standard. UUID Versions 1, 3, 4 and 5 are supported. With MIT license.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Jeremy Kenedy

uuid rfc4122

19/07 2017

2.1.2

2.1.2.0 https://github.com/jeremykenedy/laravel-uuid

Laravel package to generate a UUID according to the RFC 4122 standard. UUID Versions 1, 3, 4 and 5 are supported. With MIT license.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Jeremy Kenedy

uuid rfc4122

19/07 2017

dev-add-code-of-conduct-1

dev-add-code-of-conduct-1 https://github.com/jeremykenedy/laravel-uuid

Laravel package to generate a UUID according to the RFC 4122 standard. UUID Versions 1, 3, 4 and 5 are supported. With MIT license.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Jeremy Kenedy

uuid rfc4122

19/07 2017

2.1.1

2.1.1.0 https://github.com/jeremykenedy/laravel-uuid

Laravel package to generate a UUID according to the RFC 4122 standard. UUID Versions 1, 3, 4 and 5 are supported. With MIT license.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Jeremy Kenedy

uuid rfc4122

19/07 2017

2.1.0

2.1.0.0 https://github.com/jeremykenedy/laravel-uuid

Laravel package to generate a UUID according to the RFC 4122 standard. UUID Versions 1, 3, 4 and 5 are supported. With MIT license.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Jeremy Kenedy

uuid rfc4122

09/05 2016

2.0.1

2.0.1.0 https://github.com/webpatser/uuid

Class to generate a UUID according to the RFC 4122 standard. Support for version 1, 3, 4 and 5 UUID are built-in.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

uuid rfc4122

15/06 2015

2.0

2.0.0.0 https://github.com/webpatser/uuid

Class to generate a UUID according to the RFC 4122 standard. Support for version 1, 3, 4 and 5 UUID are built-in.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

uuid rfc4122

15/06 2015

1.5

1.5.0.0 https://github.com/webpatser/uuid

Class to generate a UUID according to the RFC 4122 standard. Support for version 1, 3, 4 and 5 UUID are built-in.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

uuid rfc4122

20/02 2015

1.4

1.4.0.0 https://github.com/webpatser/laravel-uuid

Laravel package to generate a UUID according to the RFC 4122 standard. Only support for version 1, 3, 4 and 5 UUID are built-in.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel uuid rfc4122

29/09 2014

1.3

1.3.0.0 https://github.com/webpatser/laravel-uuid

Laravel package to generate a UUID according to the RFC 4122 standard. Only support for version 1, 3, 4 and 5 UUID are built-in.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel uuid rfc4122

27/06 2014

1.2

1.2.0.0 https://github.com/webpatser/laravel-uuid

Laravel package to generate a UUID according to the RFC 4122 standard. Only support for version 1, 3, 4 and 5 UUID are built-in.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel uuid rfc4122

14/09 2013

1.0

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

Laravel package to generate a UUID according to the RFC 4122 standard. Only support for version 1, 3, 4 and 5 UUID are built-in.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel uuid rfc4122