rorecek/laravel-ulid
rorecek/laravel-ulid adds ULID support to Laravel apps, making it easy to generate lexicographically sortable, URL-safe identifiers and use them with Eloquent models. A lightweight alternative to UUIDs for primary keys and other unique IDs.
symfony/uid) but "adopt a small community wrapper vs. hand-roll ~50 lines of trait/cast code in our own base model." For most teams the hand-rolled option is the realistic comparison, since it removes a dependency.Consider it when all of the following hold:
find(), relationships) rather than generating ULIDs ad hoc in application code.Look elsewhere — or write the ~50 lines yourself — when:
symfony/uid (already a transitive dependency in most Laravel apps) and skip the wrapper.uuid columns, ULID support in an existing integer-key schema, or a migration path from existing keys. This package is not that.For executives (one paragraph): This is a small, free, open-source add-on that lets our Laravel applications use a modern ID format called ULID for new database records. Compared with the sequential numbers we use today, ULIDs don't reveal how many customers or orders we have, can be generated safely across multiple servers without a central coordinator, and still sort by creation time so lists and pagination stay fast. The main caveat is organizational, not technical: the package is maintained by one volunteer with modest adoption, so we should treat it as a convenience wrapper, budget a small amount of engineering time to own or replace it if it goes stale, and limit it to new tables rather than migrating existing data.
For engineering: It's an Eloquent integration layer — traits and casts so ULID primary keys behave like normal model keys, including route binding and relationships. The underlying algorithm is standard and already available via symfony/uid, so the real trade-off is a dependency with a low bus factor vs. ~50 lines in our base model. Recommendation: adopt for greenfield services only if it supports our current Laravel version and has recent commits; otherwise implement the trait in-house and revisit. Either way, agree on storage format (26-char string vs. binary) and URL/API exposure up front, and explicitly scope out migration of existing tables.
How can I help you explore Laravel packages today?