PHP code example of jump2 / yii2-snowflake

1. Go to this page and download the library: Download jump2/yii2-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/ */

    

jump2 / yii2-snowflake example snippets


'snowflakeServer' => [
    'class'         => 'Snowflake\Server',
    'host'          => '0.0.0.0',
    'port'          => 5599,
    'workerId'      => 1,
    'datacenterId'  => 1
],

'snowflakeClient' => [
    'class'         => 'Snowflake\Client',
    'host'          => '0.0.0.0',
    'port'          => 5599
],


echo \Yii::$app->snowflakeClient->nextId();