Skip to content

goatherd/uuid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pure PHP UUID generator

Dual-licensed under BSDL (2-clause) or Apache 2.0 license

Derived from code by Fredrik Lindberg.

Features

Optimised for use with PHP 5.3+ and psr-2 compliant.

  • Composer support (packagist)
  • format as FMT_STRING, FMT_BYTE or FMT_BINARY
  • psr-0 autoloading
  • UUID version 1 (time), 3 (md5), 4 (random) and 5 (sha1)
  • generates same UUIDs for little and big endian architecture
  • UnitTested

Usage

use \Goatherd\Uuid\Factory as Uuid;

// default: version 5 string formated uuid
$uuid = Uuid::generate();

// version 4 byte formated uuid
$uuid = Uuid::generate(Uuid::UUID_RANDOM, Uuid::FMT_BYTE);

// get version 4 uuid from generator instance
$uuidGenerator = new \Goatherd\Uuid\V4();
$uuid = $uuidGenerator(Uuid::FMT_STRING);

About

Pure PHP UUID generator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%