~/docs
Resonate
Resonate
4.x 4.0.0, current 3.x 3.0.1 2.x 2.0.1 1.x 1.3.0
UUID Library
Toggle sidebar
UUID Library
webpatser/uuid 1.3.0
You are reading the 1.x documentation
The current line is 4.x. Read this page for 4.x

UUID Library 1.x

Installation

Install the high-performance PHP UUID library that generates UUIDs according to RFC 4122 and RFC 9562.

High-performance PHP UUID library generating UUIDs according to RFC 4122 and RFC 9562 standards. 15% faster than Ramsey UUID.

composer require webpatser/uuid

Requirements

  • PHP 8.2 or higher
  • No additional extensions required
  • Pure PHP implementation

Live output

The block below generates one UUID per version on this server, each next to the call that produced it. Press Generate again for new values. The name-based rows are always the same for the same name and namespace.

Generated on this server for this page view
  • Uuid::v4() v4, random
    4d7061e1-d490-4528-8591-b3b066be2298
  • Uuid::v7() v7, time-ordered
    01a23843-3c1d-7006-baf5-152e073c3b3c
  • Uuid::generate(1) v1, time and node
    d5dd7cd0-ee87-11f1-9efa-77d2fe8d873e
  • Uuid::generate(3, 'example.com', Uuid::NS_DNS) v3, MD5 name-based
    9073926b-929f-31c2-abc9-fad77ae3e8eb
  • Uuid::generate(5, 'example.com', Uuid::NS_DNS) v5, SHA-1 name-based
    cfbff0d1-9375-5685-968c-48ce8b15ae17
  • Uuid::generate(6) v6, time-ordered (RFC 9562)
    1f1ee87d-5dd7-6d40-b535-1523e4f43419
  • Uuid::generate(8) v8, custom
    9cee7000-dc89-8a45-9ca0-2c1f7e500699
  • Uuid::nil() Nil
    00000000-0000-0000-0000-000000000000

The v3 and v5 values stay the same on every view; the others change each time.

This demo runs webpatser/uuid 3.0.0, the version installed on this site.

Laravel Integration

Note: Using Laravel? For tight Laravel integration with automatic model UUIDs, migrations, and optimized features, consider using the Laravel UUID package which includes this library with enhanced Laravel-specific functionality. View Laravel UUID Documentation

Next Steps

Explore the UUID library features and generate different UUID types with the examples.

  • Quick Start Guide: Learn the basics with practical examples and common use cases.
  • Live Examples: Interactive examples with real-time UUID generation for all versions.