jordimorillo/uid
Composer 安装命令:
composer require jordimorillo/uid
包简介
A package to self-generate 32bit unique integer identifiers that can be used as primary keys in relational databases
README 文档
README
The goal for this package is:
- To provide unique identifiers.
- The identifiers will be integer so they can be used as primary keys in relational databases to keep performance.
- Do not depend on third services to generate the Ids as happens with workers.
- The generated identifier will be 32 bytes.
The current formula is:
UniqueId = php-object-identifier + random-integer + microtime
To this identifier gets repeated it should coincide the object identifier, the microtime, and a 7 number random integer. That is really very improbable but may happen in very rare ocasion.
Example of use:
<?php use JordiMorillo\Uid\Uid; class MyProductId extends Uid {} $myProductId = new MyProductId(); echo "$myProductId"; //This should cast the identifier as a string of numbers $myProductIdString = $myProductId->toString(); $anotherProductId = new MyProductId($myProductIdString); //This should be a similar equal as $myProductId
👤 Autor
Jordi Morillo Sells — LinkedIn
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-only
- 更新时间: 2021-02-21