{"repo":"godruoyi/php-snowflake","free":true,"listed":false,"github":"https://github.com/godruoyi/php-snowflake","clone":"git clone https://github.com/godruoyi/php-snowflake.git","description":"❄ An ID Generator for PHP based on Snowflake Algorithm (Twitter announced).","language":"PHP","stars":865,"topics":["snowflake-algorithm","php","laravel","unique-id"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"An ID Generator for PHP based on Snowflake Algorithm (Twitter announced). Description Snowflake & Sonyflake algorithm PHP implementation 中文文档. Snowflake is a network service that generates unique ID numbers at a high scale with simple guarantees. 1. The first bit is an unused sign bit. 2. The second part consists of a 41-bit timestamp (in milliseconds) representing the offset of the current time relative to a certain reference time. 3. The third and fourth parts are represented by 5 bits each, indicating the data centerID and workerID. The maximum value for both is 31 (2^5 -1). 4. The last part consists of 12 bits, which represents the length of the serial number generated per millisecond per working node. A maximum of 4095 IDs can be generated in the same millisecond (2^12 -1). If you want to generate unique IDs using the snowflake algorithm, you must ensure that sequence numbers generated within the same millisecond on the same node are unique. Based on this requirement, we have created this package which integrates multiple sequence number providers. RandomSequenceResolver (Random Sequence Number, UnSafe) FileLockResolver (Uses PHP file lock fopen/flock , Concurrency Safety ) RedisSequenceResolver (Redis psetex and incrby, Concurrency safety ) PredisSequenceResolver (redis psetex and incrby, Concurrency Safety ) LaravelSequenceResolver (Laravel Cache add lock mechanism) SwooleSequenceResolver (swoole lock for Concurrency Safety ) Requirement 1. PHP = 8.1 2. Composer Instal","default_branch":null,"files":null,"tree":[],"storefront":"/r/godruoyi","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/godruoyi/php-snowflake/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}