Home

Awesome

Build Status Latest Stable Version License

Particle

Language: PHP

64bits int Time Based ID Generator

Uncoordinated

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

Solution

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/ millisecond (13 digits)

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

Time from Particle ID (w/ millisecond precision)

	$particleID = '4611692470816737853';
	Particle::timeFromParticle($particleID);