ryangjchandler/laravel-uuid
A lightweight Laravel package that brings UUID support to Eloquent models. It provides a simple trait for generating UUID primary keys and resolving models by UUID, making it easy to use UUIDs in place of auto-incrementing IDs.
creating" behavior that is otherwise ~15–40 lines in a base model. The PM decision is whether that belongs in a dependency, a shared internal trait, or is already covered by the framework.uuid column alongside an existing integer primary key (rather than replacing the key), it enables a phased rollout: add a nullable uuid, backfill, switch route model binding, keep integer FKs for join/index performance. That is a roadmap-relevant, low-risk adoption path for existing schemas.Consider it when:
uuid column next to an integer primary key — Laravel's built-in HasUuids replaces the primary key, so the "keep fast integer PKs, expose opaque public IDs" pattern often still needs custom code.Look elsewhere (or don't adopt) when:
HasUuids; for sortable keys use HasUlids. A third-party dependency buys nothing here and adds an upgrade liability.ramsey/uuid or symfony/uid.creating hook, easily replaced.For executives (1–2 sentences): "This is a very small utility that lets our records use non-guessable public identifiers instead of sequential numbers — reducing the risk of someone scraping or tampering with records by incrementing an ID in a URL. Cost is near zero and it's removable in an afternoon if we change direction; the honest recommendation is to copy the technique internally rather than depend on a package with no adoption."
For engineering: "It's a trait that assigns a UUID on model creation. Before adopting: (1) confirm the installed Laravel version doesn't already cover this via HasUuids/HasUlids; (2) confirm whether we want a UUID primary key or a UUID secondary column — we almost certainly want the latter for index performance; (3) if we proceed, vendor the trait into app/Models/Concerns with a unit test and a backfill migration, rather than adding a zero-adoption dependency. Estimated effort: half a day including backfill and route-model-binding switch; rollback is a config change."
Decision requested: approve the identifier strategy (UUID secondary keys for public-facing models) and the delivery approach (internal trait, not a third-party package), not the package itself.
How can I help you explore Laravel packages today?