Laravel UUID v6.2.0
Installation Guide
Installation - Laravel UUID v6.2.0
High-performance Laravel UUID integration providing 15-25% faster UUID generation than Laravel's built-in methods, with seamless Eloquent model integration and 55% storage savings with binary UUIDs.
Quick Installation
composer require webpatser/laravel-uuid
That's it! The package is auto-discovered by Laravel and ready to use immediately.
Requirements
- PHP 8.2 or higher
- Laravel 11.x or 12.x
- No additional extensions required
Not Using Laravel?
Using Pure PHP?
If you don't need Laravel integration features like Eloquent traits, Str macros, or validation helpers, you should use the Core UUID Library directly. It's lighter, faster, and has no Laravel dependencies.
Use Core UUID Library Instead →Architecture Overview
What's Included
Installing webpatser/laravel-uuid
automatically gives you:
🚀 Performance Features
- • 15% faster
Str::fastUuid()
vsStr::uuid()
- • 25% faster
Str::fastOrderedUuid()
- • High-performance
HasUuids
trait - • Binary UUID storage (55% space savings)
⚡ Laravel Integration
- • Auto-registered Str macros
- • Global
Uuid
facade - • Eloquent UUID casting
- • Route model binding support
Verify Installation
Test that everything works correctly:
php artisan tinker
// Test high-performance Str macrosuse Illuminate\Support\Str;$uuid = Str::fastUuid();echo "Generated: {$uuid}\n"; // Test direct UUID library accessuse Webpatser\Uuid\Uuid;$uuid7 = Uuid::v7();echo "UUID v7: {$uuid7}\n"; // Test global facade$uuid4 = Uuid::v4();echo "Via facade: {$uuid4}\n";
Expected Output
Fast UUID (15% faster)
Fast Ordered UUID (25% faster)
Example output when running the commands above in your Laravel project
Performance Comparison
Laravel Method
|
Our Method
|
Performance
|
---|---|---|
Str::uuid() | Str::fastUuid() | |
Str::orderedUuid() | Str::fastOrderedUuid() | |
Laravel HasUuids | Our HasUuids | |
CHAR(36) storage | BINARY(16) storage |