Skip to content
This repository has been archived by the owner. It is now read-only.
An RFC-4122 compliant PHP library for generating and parsing UUIDs. [DEPRECATED]
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This project has been deprecated by the authors. Use ramsey/uuid instead.

Druid is an [RFC-4122] compliant PHP library for generating and parsing universally unique identifiers (UUIDs).

composer require icecave/druid


Druid provides a generator class for each supported UUID version. UUIDs are created by first instantiating the generator for the desired UUID version, then calling the create() method.

All generator classes implement the UuidGeneratorInterface interface, and produce UUIDs that implement UuidInterface.

Generating UUIDs

Version 1 - Network address and time based identifier

// Not yet implemented.

Version 2 - Network address and time based identifier, with POSIX user information

// Not yet implemented.

Version 3 - Named-based MD5 hash identifer

// Not yet implemented.

Version 4 - Randomly generated identifier

$generator = new Icecave\Druid\UuidVersion4Generator;
$uuid = $generator->generate();

assert($uuid instanceof Icecave\Druid\UuidInterface);

Version 5 - Name-based SHA-1 identifier

// Not yet implemented.

Parsing UUIDs

UUIDs can be constructed from hexadecimal strings and binary buffers using the Uuid::fromString() and Uuid::fromBinary() methods, respectively.

$uuidFromString = Icecave\Druid\Uuid::fromString(

$uuidFromBinary = Icecave\Druid\Uuid::fromBinary(
You can’t perform that action at this time.