nevadskiy/laravel-uuid
A Laravel package that adds UUID support to Eloquent models, making it easy to use universally unique identifiers as primary keys. It provides traits and helpers for generating and assigning UUIDs automatically, simplifying setup and integration with existing models.
Architecture fit. The package is intentionally minimal: a single Eloquent trait that swaps the auto-incrementing integer primary key for a UUID. That aligns cleanly with Laravel’s trait-composition conventions for models and requires no service provider, facade, or config layer in the typical case. The architectural concern is strategic rather than structural: Laravel 9+ ships HasUuids and HasUniqueStringIds in the framework itself, and both cover the same ground. For any application on a supported Laravel version, this package is functionally redundant. Its remaining value is limited to legacy Laravel 8-and-earlier codebases or teams that prefer an external, explicitly pinned dependency over framework behavior.
Integration feasibility. Low effort for greenfield work. The expected path is: composer require nevadskiy/laravel-uuid, add the trait to the model, ensure $keyType = 'string' and $incrementing = false are handled (either by the trait or manually), and declare the migration column as uuid/char(36). The real work is downstream: every foreign key referencing the table must change type, route model binding must be verified, factories and seeders must stop assuming integers, and API contracts change shape (string vs int IDs). That work is migration effort, not package effort.
Technical risk. Adoption signals are the dominant risk here: zero stars, zero dependents, and a composite opportunity score in the low teens indicate the package has not been exercised in the wild. Specific risks:
illuminate/support constraints; may break on Laravel 10/11/12 or PHP 8.2+.char(36) primary keys are ~4.5x the size of bigint, compounded across every secondary index and foreign key.Key questions.
getKeyType(), getIncrementing(), and getKeyName(), or does it require manual model configuration?illuminate/* version constraints, and is Laravel 11/12 supported?UniqueIds / is it compatible with the native HasUuids interface?uuid columns?Stack fit. Appropriate for Laravel 8-and-earlier applications using Eloquent on MySQL, Postgres, or SQLite where integer PKs are being replaced for external-facing identifiers. For Laravel 9+, the correct recommendation is to use the framework’s native traits and treat this package as a reference implementation, not a dependency.
Migration path. Two distinct scenarios:
uuid column alongside the existing integer PK, (2) backfill in batches, (3) add a unique index, (4) update foreign keys and application code to reference the UUID, (5) switch the model’s key, (6) drop the integer PK only after a soak period. Do not attempt an in-place PK type change on a live table.Compatibility. Verify the composer constraints against the target Laravel and PHP versions before committing. Pin the exact version, and confirm behavior on the specific database driver — MySQL has no native UUID type (Laravel maps uuid() to char(36)), Postgres does, and SQLite treats it as text. Cross-driver consistency should be tested explicitly if the team supports more than one.
Sequencing.
HasUuids.Maintenance. The package itself is trivial code — a fork or in-house replacement is a few dozen lines, which caps the maintenance downside. The real cost is ownership of the convention: someone must decide UUID version, storage format, and migration patterns, and document them. Treat the dependency as replaceable by design and keep an internal fallback trait ready.
Support. Expect no meaningful community support: no dependents, no issue ecosystem, no Stack Overflow corpus. Documentation is likely the README only. Onboarding knowledge must be internalized and written down rather than sourced from the vendor.
Scaling. This is the most consequential operational factor. Random UUIDs as clustered primary keys degrade write throughput on InnoDB as tables grow — page splits, larger indexes, more IO per insert. Secondary indexes and foreign keys each carry the 36-byte payload. For high-write tables, prefer ordered UUIDs (v7) or binary(16) storage; if the package only emits v4, that constraint should be documented and, where it matters, overridden at the application layer.
Failure modes.
find() calls assuming integers.Ramp-up. Minimal for any Laravel developer — the trait pattern is familiar and the surface area is small. The ramp-up cost sits with migration planning, database performance review, and API contract coordination, not with learning the package. Budget accordingly: the package is a one-hour decision; the schema and contract changes are the project.
How can I help you explore Laravel packages today?