MichaelContento/simpleflake-php

此包已被废弃且不再维护。未建议替代包。

dev-master 2015-12-07 09:15 UTC

This package is not auto-updated.

Last update: 2020-01-20 03:39:08 UTC


README

Travis 状态: 构建状态

PHP中用于懒人分布式ID生成的解决方案。基于SawdustSoftware的出色python实现

您可以在Sawdust Software博客上阅读此功能概述及其产生的背景。

用法

<?php

require "simpleflake.php";

$newId = \simpleflake\generate();
echo "ID: $newId\n";

$parts = \simpleflake\parse($newId);
echo "Timestamp:  " . $parts["timestamp"] . "\n";
echo "RandomBits: " . $parts["randomBits"] . "\n";