Many systems need unique identifiers that are not only random, but also sortable, compact, and efficient to generate. Standard UUIDs are long, heavy, and not always a great fit for high-throughput applications.
I created UTID (Unique Timestamp ID) as a lightweight, production-ready alternative. It is inspired by existing solutions such as X/Twitter’s Snowflake ID, but simplified and adapted for PHP and Python projects.
My Approach
- Time-based and sortable -- Each UTID encodes a timestamp, making IDs naturally ordered by creation time.
- Compact representation -- Integer or base32hex string formats are supported, much shorter than UUIDv4.
- Configurable lifespan -- The default offset covers 2011-2080, but this can be shifted easily by changing a single constant. For example, a new project starting today might choose 2025-2094.
- Process-safe -- Each generator has a process ID part to prevent collisions across multiple workers.
- Randomized for uniqueness -- A random component ensures no two IDs generated in the same millisecond collide.
- Customizable encoding -- Base32hex is the default (digits 0-9 and letters a-v, as in RFC 4648 §7). This makes strings case-insensitive and leaves four letters free for use as delimiters when concatenating UTIDs with other data (such as validation codes or metadata). Other encodings (classic base32 per RFC 4648 §6, base58, base62, etc.) can be supported if required.
- Immutable object -- Each UTID is a clean, immutable value object with clear getters for timestamp, process ID, and random part.
Clean Interfaces for Flexibility
Each UTID implementation follows a simple, consistent interface:
- Construct from timestamp, int, or base32 string.
- Convert back and forth between formats (
asInt(),asBase32String()). - Extract datetime information (
getDateTime(),formatDateTime()). - Serialize IDs safely for logging, storage, or transmission.
This makes UTIDs a drop-in replacement for UUIDs in many systems, while keeping your code easy to maintain.
Example Uses
- Primary keys in databases (sortable, avoids random UUID fragmentation)
- Request/Correlation IDs for tracing across services and distributed logging
- Session IDs
- Message or event identifiers in queues and pub/sub systems
- Compact unique identifiers for APIs
- Time-aware ordering without extra timestamp columns
What I Offer
Consulting and Setup
I can help you integrate UTIDs into your project, whether in PHP, Python, or both. This includes designing ID strategies for databases, APIs, and distributed services.
Custom Development
I can extend or adapt UTID for your specific use case:
- Add alternative encodings (base58, base62)
- Integrate with existing UUID systems
- Wrap into a centralized ID service
- Optimize for your framework or ORM
Migration and Conversion
Need to migrate from UUIDs or auto-increment IDs? I can design and implement scripts to:
- Convert existing IDs to UTIDs
- Backfill UTIDs for legacy records
- Smoothly transition APIs and clients to use UTIDs
Use-Case Guidance
Not sure if UTIDs are the right fit? I can advise on:
- When to use time-based IDs vs. random UUIDs
- Tradeoffs in database indexing and storage
- Logging and tracing strategies with correlation IDs
- High-throughput generation patterns
- Long-term maintainability
Why Work With Me?
- Focused stack -- PHP and Python implementations available
- Proven in production -- UTIDs have been running in real-world projects for years
- Pragmatic solutions -- Clean, object-oriented, dependency-managed architecture
- Performance-minded -- Designed for speed and simplicity in high-traffic environments
Get in Touch
If you would like to discuss a project or need help integrating UTIDs into your system, contact me.