real-digital/half-flake
Composer 安装命令:
composer require real-digital/half-flake
包简介
HalfFlake is a PHP library for distributive generating unique ID numbers using Twitter's Snowflake Algorithm
README 文档
README
HalfFlake is a PHP library for distributive generating unique ID numbers using Twitter's Snowflake Algorithm.
Installation
via Composer
$ composer require real-digital/half-flake
via GitHub
$ git clone https://github.com/real-digital/half-flake.git
Usage
<?php use Real\HalfFlake; // an unique pair of constants defined per node const ID_DATACENTER = 1; const ID_NODE = 1; $shard = new HalfFlake\Seed(ID_DATACENTER, ID_NODE); $clock = new HalfFlake\Time(); try { $generator = new HalfFlake\Generator($shard, $clock); $id = $generator->nextId(); } catch (HalfFlake\RuntimeException $e) { // handle errors }
Testing
composer test
License
HalfFlake is licensed under the MIT License. Please see LICENSE for details.
Changelog
Please see CHANGELOG for more information.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-28