talira

ramsey/uuid

A PHP library for generating and working with UUIDs

open sourceMITfree

ramsey/uuid is a PHP library for generating and working with universally unique identifiers. It creates RFC 9562 UUIDs of every version, 1 to 8 (time-based, name-based with MD5 or SHA-1, random, reordered-time and Unix-epoch-time), handles GUIDs and other nonstandard formats, converts version 7 UUIDs to ULIDs, and has codecs and guidance for storing UUIDs in a database as strings or bytes and as primary keys. It installs with Composer and is MIT licensed.

Problems it solves

  • generate a UUID in PHP
  • use time-ordered UUIDs as database primary keys in a PHP app
  • convert a GUID to a UUID in PHP

Features

  • RFC 9562 UUID versions 1 to 8
  • GUIDs and nonstandard UUIDs
  • Version 7 to ULID conversion
  • Ordered-time and timestamp-first COMB codecs for databases
  • Custom factories, validators and calculators