nilportugues/uuid
Composer 安装命令:
composer require nilportugues/uuid
包简介
Library to encapsulate the latest and more secure Uuid versions
README 文档
README
Uuid Generator
This class' intent is to encapsulate Uuid's latest and more secure versions removing the need to explicitly hard-code a Uuid version everywhere.
1. Installation
The recommended way to install the Uuid Generator is through Composer. Run the following command to install it:
php composer.phar require nilportugues/uuid
2. Usage
Usage is real simple, you can create your Uuid right away or under certain namespaces.
2.1. Without namespacing
This is the most common case. Usage is straight-forward:
<?php use NilPortugues\Uuid\Uuid; echo Uuid::create(); // "13dfa123-d7a6-4082-8b3f-513c28f5d691"
2.2. With namespacing
First of all, the following namespaces exists:
- DNS Namespace
- URL Namespace
- OID (Object Id) Namespace
- X500 Namespace
Code-wise it's use can be defined using a constant.
<?php use NilPortugues\Uuid\Uuid; echo Uuid::create(Uuid::NAMESPACE_DNS, 'nilportugues.com'); echo Uuid::create(Uuid::NAMESPACE_URL, 'http://nilportugues.com/robots.txt'); echo Uuid::create(Uuid::NAMESPACE_OID, 'Foo\Bar'); echo Uuid::create(Uuid::NAMESPACE_X500, '/c=us/o=Sun/ou=People/cn=Rosanna Lee');
More on its usage can be found here: http://tools.ietf.org/html/rfc4122#appendix-C
2.3. Uuid versions
Currently Uuid has 5 versions and while all of them are valid, usage of newest versions is always preferred. Lastest preferred versions are:
- Uuid4 preferred over Uuid1.
- Uuid5 preferred over Uuid3 and Uuid1
3. Quality
To run the PHPUnit tests at the command line, go to the tests directory and issue phpunit.
This library attempts to comply with PSR-1, PSR-2, and PSR-4. If you notice compliance oversights, please send a patch via pull request.
4. Author ↑
Nil Portugués Calderó
5. License ↑
The code base is licensed under the MIT license.
nilportugues/uuid 适用场景与选型建议
nilportugues/uuid 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.62k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2015 年 02 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 nilportugues/uuid 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nilportugues/uuid 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11.62k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 26
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-14