fahriztx/model-uuid
Laravel/PHP trait to add automatic UUIDs to Eloquent models. Generates a UUID when creating records and supports using UUIDs as primary keys or additional identifiers, reducing reliance on auto-increment IDs and easing integration across systems.
uuid column migration helpers).user-abc123 instead of id=42) for URLs or client-side references.Adopt if:
fillable, casts, and primaryKey auto-configuration).ramsey/uuid) with extra setup.Look elsewhere if:
Str::uuid(), which may not be optimized for bulk inserts).For Executives: *"This package lets us replace fragile auto-increment IDs with UUIDs—globally unique, secure, and scalable—without rewriting our entire database layer. It’s a drop-in solution for:
For Engineering: *"This package abstracts UUID handling in Laravel with these key benefits:
v7 for sortable timestamps).Str::uuid() (optimized for most use cases); we can swap the underlying generator later if needed.
Tradeoffs:For Developers: *"Here’s how this simplifies UUID adoption:
composer require fahriztx/model-uuid.use HasUuid; to your model and optionally tweak UUID settings in AppServiceProvider.Schema::uuid().
Example:use FAHRIZTX\ModelUuid\HasUuid;
class User extends Model {
use HasUuid; // Auto-configures primaryKey, casts, and fillable
}
Extensible: Need UUIDv7? Override the generateUuid() method. Want hyphens? Configure it in the service provider.
Docs: GitHub README is minimal but clear—we can add internal examples for our stack."*
How can I help you explore Laravel packages today?