PHP code example of artnum / snowflake53

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

    

artnum / snowflake53 example snippets




use Snowflake53\ID;

class IDGen {
    use ID;
}

$gen = new IDGen();
echo $gen->get53() . PHP_EOL;
echo $gen->get64() . PHP_EOL;




use Snowflake53\ID;

class IDGen {
    use ID;
}

echo IDGen::get53() . PHP_EOL;
echo IDGen::get64() . PHP_EOL;



use Snowflake53\ID;

class IDGen {
    use ID;
}

IDGen::destroySHM(); 



use Snowflake53\ID;

class IDGen {
    use ID;
}

IDGen::$SHMPath = '/tmp/snowflake53';
echo IDGen::get53() . PHP_EOL;
echo IDGen::get64() . PHP_EOL;


$gen = new IDGen();
$gen::$SHMPath = '/tmp/snowflake53';
echo $gen->get53() . PHP_EOL;
echo $gen->get64() . PHP_EOL;