Skip to content

fieldinrain/ukey

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ukey

Based on the Twitter Snowflake algorithm

PHP unique ID generator

functions list:

    1. string ukey_next_id(void);
         Get the next unique ID.
    1. int ukey_to_timestamp(string ID);
         Change unique ID to timestamp.
    1. array ukey_to_machine(string ID);
         Change unique ID to machine info.

example:


<?php
$id = ukey_next_id();
echo $id;

$timestamp = ukey_to_timestamp($id); echo date('Y-m-d H:i:s', $timestamp); ?>

install:


$  cd ./ukey
$  phpize
$  ./configure
$  make
$  sudo make install

php.ini configure entries:


[ukey]
ukey.worker = integer
ukey.datacenter = integer
ukey.twepoch = uint64

About

PHP unique ID generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published