tuupola/ksuid
PHP library for generating and parsing KSUIDs: globally unique, K-sortable identifiers with a timestamp component. Produces compact 27-character Base62 strings, useful for database keys and distributed systems where time-ordered IDs matter.
sort.Adopt when:
composer require and read in an afternoon.Look elsewhere when:
For executives: This is a small, free, MIT-licensed library that lets us generate unique record identifiers that sort by creation time — automatically, across any number of servers, with no central coordination service to build or operate. It removes a class of "ID collision" and "sequence bottleneck" incidents before they happen, and it makes pagination and audit trails cheaper to build. Cost of adoption: one dependency. Cost of not deciding deliberately: we inherit whatever our ORM does by default and live with it for years.
For engineering: tuupola/ksuid is a faithful PHP implementation of Segment's KSUID: 4-byte timestamp + 16 random bytes, base62-encoded to 27 characters. It's a thin, readable wrapper — treat it as vendorable code, not a strategic dependency. The honest recommendation is to evaluate it against UUIDv7 and pick once, before the first table is created. KSUID buys you shorter, more readable IDs and second-level sortability; UUIDv7 buys you a standard, broader tooling, and Postgres-native support. Either is defensible; drifting into it by accident is not.
How can I help you explore Laravel packages today?