limingxinleo/x-php-snowflake

snowflake 64位自增ID算法

1.0.2 2018-01-04 05:47 UTC

This package is auto-updated.

Last update: 2024-12-17 19:56:15 UTC


README

snowflake 64位自增ID算法

安装

composer require limingxinleo/x-php-snowflake

使用

  • 实现自己的Id类
<?php 
namespace Tests\Snowflake;

use Xin\Snowflake\Client;

class Test extends Client
{
    public function getBeginAt()
    {
        return strtotime('2017-01-01');
    }
}
  • 调用
<?php

$id = Test::getInstance()->id(1, 1);