yiranzai/snowflake

This package to generate 64 bit identifier, use snowflakes from Twitter.

v0.1.1 2019-04-09 03:43 UTC

This package is auto-updated.

Last update: 2024-04-11 19:32:06 UTC


README

ENGLISH | 中文

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

This package to generate 64 bit identifier, use snowflakes from Twitter.

Structure

src/
tests/

Install

Via Composer

$ composer require yiranzai/snowflake

Usage

$id = \Yiranzai\SnowFlake\SnowFlake::next($dataCenterId = 1, $workerId = 2);
$node = \Yiranzai\SnowFlake\SnowFlake::analysis($id);

echo $node->dataCenterID; // 1
echo $node->workerID; // 2

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email wuqingdzx@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.