Ever wondered how Twitterโs Snowflake IDs actually work? ๐ง
You donโt need a huge system to build one.
Just mix:
๐ timestamp bits
๐งฉ machine id
๐ข sequence counter
Thatโs it โ unique, ordered, and distributed.
Sometimes simplicity wins. โ๏ธ
#PHP#Laravel#ObjectId#Snowflake
Choosing an ID isnโt about syntax โ itโs about scale & topology.
BigInt โ single node
UUID/ULID โ multi region
ObjectId โ distributed & time-aware
Stay tuned for our next deep dive on how ObjectId performs across MySQL & PostgreSQL. โก
#Laravel#PHP#UUID#ULID#ObjectId
Every system needs unique IDs.
But not all IDs are created equal.
Letโs break down the 5 main types developers use today โ and when each one makes sense ๐
BigInt / UUID v4 / UUID v7 / ULID / ObjectId
# ULID & ObjectId
Both embed a timestamp + randomness.
Sortable by creation time.
Compact (26 / 24 chars).
ObjectId also encodes machine + process info = naturally distributed.
โ Ideal for scalable, sharded systems.
@e_lfanew@jontybehr@PovilasKorop Fair point โ Postgres UUID type is great when you stay in that stack.
ObjectId focuses on cross-DB portability (MySQL, SQLite, Postgres) and fast, ordered IDs in pure PHP.
Not for crypto โ for performance & indexing.
Binary mode planned
Weโve seen your questions about binary columns, BigInt, and real-world performance ๐
โ ObjectId is optimized for both read & write ops.
โ Binary mode is on the roadmap โ with proper casting.
โ Benchmarks done. Coming soon.
#Laravel#PHP#ObjectId#UUID#ULID
@amitgupta@PovilasKorop Good point, Amit โ indeed uniqueness is critical! ObjectId ensures uniqueness through a 96-bit structure (timestamp + machine + process + counter), similar to MongoDBโs proven design โ practically collision-free even at millions/sec. Appreciate your insight! ๐
โก Tiny release tonight (PHP improvements)
Big update this weekend โ with deeper benchmarks on real apps (tens of thousands of records & relations).
Follow @ihfbib for upcoming performance reports!
#Laravel#PHP#OpenSource#Database#UUID#ULID
๐ We're building Laravel ObjectId at WooServ Labs โ bringing MongoDB-style performance to pure PHP & Laravel.
Hereโs a quick thread on how it compares to UUID and ULID, what weโve learned from benchmarks, and where weโre heading ๐
@lo_fye@amitgupta@PovilasKorop Exactly, Derek โ thatโs a great clarification.
ObjectIdโs structure was designed for distributed systems too, embedding time and process entropy to avoid replication conflicts.
Will include more replication-style benchmarks soon
@arcticawe@PovilasKorop Good idea! bigint is definitely worth including for reference โ itโs the classic baseline for auto-increment setups.
Weโll add it to the next benchmark round alongside UUIDv7 and binary ObjectId mode.
Thanks for the suggestion.