Laravel UUID v6.2.0

Installation Guide

webpatser@dev: ~/laravel-uuid/6.2.0 $ composer require webpatser/laravel-uuid

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

Split Architecture (v6.0+)
This package is a Laravel integration layer built on top of the webpatser/uuid core library. The core library handles all UUID generation and validation, while this package provides Laravel-specific features like Eloquent integration, Str macros, and binary storage. View Core UUID Documentation →

What's Included

Installing webpatser/laravel-uuid automatically gives you:

🚀 Performance Features

  • • 15% faster Str::fastUuid() vs Str::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 macros
use Illuminate\Support\Str;
$uuid = Str::fastUuid();
echo "Generated: {$uuid}\n";
 
// Test direct UUID library access
use 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)
550e8400-e29b-41d4-a716-446655440000
Fast Ordered UUID (25% faster)
018f4e7c-8b3a-7000-8000-123456789abc

Example output when running the commands above in your Laravel project

Performance Comparison

Laravel Method
Our Method
Performance
Str::uuid() Str::fastUuid()
15% faster
Str::orderedUuid() Str::fastOrderedUuid()
25% faster
Laravel HasUuids Our HasUuids
15% faster
CHAR(36) storage BINARY(16) storage
55% smaller

Next Steps