PHP code example of nurfachmi / cuid2

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

    

nurfachmi / cuid2 example snippets



ew (default length of 24)
$cuid = new Nurfachmi\Cuid2\Cuid2();

// implicit casting
echo $cuid; // hw8kkckkgwkk0oo0gkw0o8sg

// explicit casting
echo $cuid->toString(); // hw8kkckkgwkk0oo0gkw0o8sg

// new (with custom length)
$cuid = new Nurfachmi\Cuid2\Cuid2(10);
echo $cuid; // psk8844ck4