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.
-
Uuid::v4()v4, random4d7061e1-d490-4528-8591-b3b066be2298 -
Uuid::v7()v7, time-ordered01a23843-3c1d-7006-baf5-152e073c3b3c -
Uuid::generate(1)v1, time and noded5dd7cd0-ee87-11f1-9efa-77d2fe8d873e -
Uuid::generate(3, 'example.com', Uuid::NS_DNS)v3, MD5 name-based9073926b-929f-31c2-abc9-fad77ae3e8eb -
Uuid::generate(5, 'example.com', Uuid::NS_DNS)v5, SHA-1 name-basedcfbff0d1-9375-5685-968c-48ce8b15ae17 -
Uuid::generate(6)v6, time-ordered (RFC 9562)1f1ee87d-5dd7-6d40-b535-1523e4f43419 -
Uuid::generate(8)v8, custom9cee7000-dc89-8a45-9ca0-2c1f7e500699 -
Uuid::nil()Nil00000000-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.