Awesome Open Source
Awesome Open Source

Build Status Latest Stable Version License


Language: PHP

64bits int Time Based ID Generator


For high availability within and across data centers, machines generating ids should not have to coordinate with each other.


  • PHP (tested on v7.1.8)
  • Particle Id (64 bits) is composed of:
    • time - 42 bits (millisecond precision w/ a custom epoch)
    • configured machine id - 10 bits - up to 1024 machines
    • sequence number - 12 bits - up to 4096 random numbers

System Clock Dependency

You should use NTP to keep your system clock accurate.

How to use it

Generate Particle ID

Change const EPOCH in particle class to today epoch time w/ miliseconds (13 digits)

	$machineID = 0; // Machine ID (aka Server ID no.)

Time from Particle ID (w/ milisecond precision)

	$particleID = '4611692470816737853';

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
php (16,075
ids (31

Find Open Source By Browsing 7,000 Topics Across 59 Categories