PHP code example of yiranzai / snowflake
1. Go to this page and download the library: Download yiranzai/snowflake library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yiranzai / snowflake example snippets
$id = \Yiranzai\SnowFlake\SnowFlake::next($dataCenterId = 1, $workerId = 2);
$node = \Yiranzai\SnowFlake\SnowFlake::analysis($id);
echo $node->dataCenterID; // 1
echo $node->workerID; // 2