2017 © Pedro Peláez
 

library uuid

Time Based UUID Generator

image

fwolf/uuid

Time Based UUID Generator

  • Thursday, October 13, 2016
  • by fwolf
  • Repository
  • 1 Watchers
  • 1 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Time Based UUID Generator

Travis Latest Stable Version License SensioLabsInsight Scrutinizer Code Quality, (*1)

Generate time based UUID, with custom format and length., (*2)

UUIDs follow alphabetical order, more suitable for database primary key., (*3)

Short UUID save more space, and little more eye candy., (*4)

Check digit can determine if an UUID is valid, maybe useful., (*5)

Install

composer require fwolf/uuid:~1.1

UUID Types

Name FQN Length Example
Base16 Fwolf\Util\Uuid\Base16 36 57fbbc3d-afca-0001-5962-39f13698e4fe
Base16WithCheckDigit Fwolf\Util\Uuid\Base16WithCheckDigit 36 57fbbc3d-afd6-0001-5962-66ede233d441
Base36 Fwolf\Util\Uuid\Base36 25 1bjzaogobg01b0tjd6q2qx6t9
Base36Short Fwolf\Util\Uuid\Base36Short 16 1bjzaogok11ggcm5
Base62 Fwolf\Util\Uuid\Base62 24 1BTD4N3MsO01qbPidY17hfOz
Base62Short Fwolf\Util\Uuid\Base62Short 15 10L1XTQ9s1Ip2Og

By inherit these classes and modify constant value, you can:, (*6)

  • Define length of each part
  • Enable check digit
  • Change of enable/disable separator between parts

Usage

use Fwolf\Util\Uuid\Base36;

$generator = new Base36();

$uuid = $generator->generate();
echo "Generated UUID: {$uuid}";
// Result: Generated UUID: 1bjzaogobg01b0tjd6q2qx6t9

There are some utility scripts in bin directory:, (*7)

  • explain.php Disassemble UUID to parts and generated time
  • find-offset-base36.php Find latest offset timestamp for Base36
  • find-offset-base62Short.php Find latest offset timestamp for Base36Short

License

Distribute under MIT License., (*8)

The Versions

13/10 2016

dev-master

9999999-dev

Time Based UUID Generator

  Sources   Download

MIT

The Requires

 

by Avatar fwolf

uuid time based

13/10 2016

v1.1

1.1.0.0

Time Based UUID Generator

  Sources   Download

MIT

The Requires

 

by Avatar fwolf

uuid time based

10/10 2016

v1.0

1.0.0.0

Time Based UUID Generator

  Sources   Download

MIT

The Requires

 

by Avatar fwolf

uuid time based