PHP code example of pg_ito / fast_ulid

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

    

pg_ito / fast_ulid example snippets


$loader = o\FastUlid\FastUlid;

echo FastUlid::gen().PHP_EOL;
// 01GBTYCV1VFFEC1VTRXFJ2VPN7

$ php -v
PHP 8.1.2 (cli) (built: Jul 21 2022 12:10:37) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

$ php bench.php 
number of generated ids 1000000
elapsed 2.1725078 Sec.
2172.5078 nSec/generate