duoshuo / uuid
一个用于生成 RFC 4122 版本 1、3、4 和 5 的通用唯一标识符(UUID)的 PHP 5.4+ 库
dev-master
2014-09-21 15:09 UTC
Requires
- php: >=5.4.0
This package is auto-updated.
Last update: 2024-09-23 20:53:58 UTC
README
A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).
依赖关系
- PHP 5.4+
- 64位 Linux 系统
安装
Append dependency into composer.json
...
"require": {
...
"duoshuo/uuid": "dev-master"
}
...
使用方法
use Uuid\Uuid; // At beginning, set your Ethernet Controller MAC address. Uuid::setMAC('56:84:7a:fe:97:99'); // Version 1 Uuid::now(); // Version 1, first argument is timestamp, second argument is micro seconds. Uuid::fromTimestamp(1410584506, 792720); // Version 3 Uuid::fromMd5(md5($string)); // Version 4 Uuid::fromRandom(); // Version 5 Uuid::fromSha1(sha1($string));