Generate CUID using PHP

endyjasmi/cuid library

  1. Add endyjasmi/cuid library to composer.json file:
"require": {
    "endyjasmi/cuid": "^2.1"
}
  1. Install library from the command line:
composer install
  1. Generate CUID:
<?php

require_once __DIR__.'/vendor/autoload.php';

use EndyJasmi\Cuid;

$cuidStr = Cuid::cuid();
echo $cuidStr;

Leave a Comment

Cancel reply

Your email address will not be published.