hidehalo/nanoid-php library
- Add
hidehalo/nanoid-php
library tocomposer.json
file:
"require": {
"hidehalo/nanoid-php": "^1.1"
}
- Install library from the command line:
composer install
- Generate Nano ID:
<?php
require_once __DIR__.'/vendor/autoload.php';
use Hidehalo\Nanoid\Client;
$client = new Client();
$nanoIdStr = $client->generateId();
echo $nanoIdStr.PHP_EOL;
$nanoIdStr = $client->formatedId('0123456789abc', 10);
echo $nanoIdStr.PHP_EOL;
Leave a Comment
Cancel reply