khalyomede/laravel-eloquent-uuid-slug
A Laravel package that adds UUID slug support to Eloquent models, automatically generating unique, URL-friendly identifiers for your records so you can reference them in routes and links instead of exposing numeric IDs.
getRouteKeyName() + UUID column + model trait in-house, or (c) use Laravel's built-in HasUuids / HasUniqueStringIds traits, which cover the same ground natively on modern Laravel. This package is a thin convenience layer over a problem the framework mostly solved itself.Consider it when:
HasUuids is not available, and you need route-key UUIDs with minimal ceremony.Look elsewhere (or build in-house) when:
HasUuids and HasUniqueStringIds ship in the framework. Adopting a 23-star third-party package to duplicate a first-party trait is a net negative on maintenance, security review surface, and onboarding.whereUuid resolution, pivot lookups, model events firing on creation) have likely been exercised by approximately one person: the author./products/blue-widget-2xl, this package does not address it and you need a transliteration-based slug library instead.Decision rule: treat this as a reading reference and a shortcut for legacy stacks, not as a long-term dependency for a new build.
For executives (one paragraph):
We expose database record numbers in our URLs and API responses today, which means anyone can increment a number and walk through our customers' data. The fix is to give each record a random, unguessable public identifier instead. The good news is this is a small, well-understood change and our framework now supports it natively — we do not need to buy anything or adopt a risky new dependency. The work is in the data migration and the redirect window for existing links, not in the code. I recommend we scope it as a two-week hardening item before the public launch of [feature], because doing it after launch means maintaining dual URL formats indefinitely.
For engineering (the actual ask):
getRouteKeyName() and add a unique indexed UUID column, or does it replace the primary key? We want the former. If it's the latter, stop — that's a write-throughput and storage cost we don't need to accept.HasUuids / HasUniqueStringIds gets us there with less surface area. If yes, the recommendation is build in-house, ~20 lines, and use this repo only as a reference for the route-binding edge cases.null-tolerant rollout; whereUuid()-style lookups on hot paths; explicit decision on whether legacy integer URLs 301-redirect or 404 during the deprecation window.How can I help you explore Laravel packages today?