juniorb2ss/eloquent-uuid
Eloquent UUID adds UUID support to Laravel's Eloquent models, letting you use universally unique identifiers as primary keys with minimal configuration. Useful for distributed apps or anywhere non-sequential IDs are preferred.
Architecture fit. The package is a single Eloquent trait intended to swap an auto-incrementing primary key for a UUID at model boot time. Architecturally this is the correct idiomatic Laravel pattern — traits hooking creating events are how the framework itself solves this — so the shape of the integration is sound and imposes no framework inversion or service-provider overhead. The problem is scope overlap: Laravel 9+ ships Illuminate\Database\Eloquent\Concerns\HasUuids (and HasUniqueStringIds in Laravel 10/11) natively, so for any modern stack this package is functionally redundant. Its value proposition only exists on legacy Laravel 5.x–8.x codebases.
Integration feasibility. Mechanically trivial: composer require, add use Uuid; to target models, and change migrations from $table->increments('id') to $table->uuid('id')->primary(). The real cost is not the trait — it is the schema decision it forces. Every foreign key referencing the table must become uuid, every pivot table must match, and any existing data requires a backfill. For a greenfield service this is a one-day change; for a system with existing relational data it is a multi-sprint migration.
Technical risk. High relative to the value delivered, driven almost entirely by project health rather than code complexity:
$incrementing = false and $keyType = 'string', which UUID version it generates, and whether it guards against trait boot method collisions with other traits (a classic Laravel footgun).Key questions.
composer.json, and is the package tested against them?$incrementing = false and $keyType = 'string', or does it rely on the caller?boot() on the same model?upsert/bulk-create paths correctly?Stack fit. The package fits Laravel 5.x through 8.x comfortably and is misaligned with Laravel 9+. For any application on a supported Laravel version, the correct decision is to use the framework's native HasUuids and treat this package as unnecessary. Adoption should be scoped strictly to legacy codebases where upgrading the framework is off the table.
Migration path. There are two distinct scenarios and they should not be conflated:
$table->uuid('id')->primary() from the start. Cheap, reversible, low risk.uuid column), dual-write or backfill, foreign-key repointing, and a cutover — realistically a phased rollout with a rollback plan, not a single deploy.Given the package's size, the strongest recommendation is vendoring rather than depending: copy the trait (or write the ~20 lines yourself) into app/Models/Concerns/. This eliminates the abandoned-dependency risk entirely at negligible cost, and lets you control UUID version and ordered-ID behavior directly.
Compatibility. Verify the composer.json constraints against your PHP and Laravel versions before anything else — a stale constraint will silently resolve to an old tag or fail install. Also audit models for existing trait boot collisions, since trait boot method conflicts surface as runtime errors rather than install-time failures.
Sequencing.
HasUuids.Maintenance. Effectively zero upstream maintenance guarantee. With 0 dependents there is no community pressure to keep the package current, and no incentive for the maintainer to track Laravel internals. Vendoring the code converts an external dependency into ~20 lines of owned code — this is the recommended posture and reduces long-term maintenance to near zero.
Support. No vendor, no SLA, no security disclosure process. Any defect becomes an internal ticket. Mitigated substantially by the small surface area: a competent Laravel engineer can read and fix the entire package in under an hour.
Scaling. The operational risks here are structural, not package-specific, and must be owned by the adopting team:
Failure modes. Watch for: trait boot collisions producing duplicate or missing UUID assignment; models missing $incrementing = false returning string keys treated as integers; foreign-key type mismatches causing silent truncation or failed constraint creation; route-model-binding returning 404s if key type is misconfigured; and mass-assignment or upsert paths bypassing the creating event entirely and inserting null PKs.
Ramp-up. Effectively zero for any Laravel developer — the trait pattern is standard and the code is a few lines. The non-trivial learning curve is organizational, not technical: teams must internalize the schema-wide implications of UUID primary keys (foreign-key types, index strategy, storage budget) before the first migration ships, because retrofitting after data exists is orders of magnitude more expensive.
How can I help you explore Laravel packages today?