Where can I find a php lib for generating time-based (v1) UUID?

扶醉桌前 提交于 2019-12-08 12:37:09

问题


Where can I find a php lib for generating time-based (v1) UUID?

Thanks in advance!


回答1:


I assume you want something like this:

  • http://www.shapeshifter.se/2008/09/29/uuid-generator-for-php/
  • https://github.com/fredriklindberg/class.uuid.php

E.g.:

require_once('class.uuid.php');
$str = UUID::generate(UUID::UUID_TIME, UUID::FMT_STRING, "abcdef");
echo $str;
// Output: 1b55e723-578b-4e34-d5cf-616263646566



回答2:


For a native RFC compliant implementation, see http://jkingweb.ca/code/php/lib.uuid/

This implementation does not include code for acquiring MAC address to generated real v1 UUIDs (neither does any native PHP implementation I've seen).

If you can use PECL uuid package, go for it.



来源:https://stackoverflow.com/questions/9321414/where-can-i-find-a-php-lib-for-generating-time-based-v1-uuid

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!