PHP code example of endyjasmi / cuid

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

    

endyjasmi / cuid example snippets


// Include composer autoloader
id = new EndyJasmi\Cuid;

// Generate normal cuid
$normalCuid = $cuid->cuid(); // ci27flk5w0002adx5dhyvzye2

// Generate short cuid
$shortCuid = $cuid->slug(); // 6503a5k0

// You can also generate cuid using static method
$normalCuid = Cuid::cuid();
$shortCuid = Cuid::slug();

// There is also an alias method for better readability
$normalCuid = Cuid::make();