1. Go to this page and download the library: Download hidehalo/nanoid-php 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/ */
hidehalo / nanoid-php example snippets
bash
composer
php
use Hidehalo\Nanoid\Client;
use Hidehalo\Nanoid\GeneratorInterface;
$client = new Client();
# default random generator
echo $client->generateId($size = 21);
# more safer random generator
echo $client->generateId($size = 21, $mode = Client::MODE_DYNAMIC);
php
# PS: anonymous class is new feature when PHP_VERSION >= 7.0
echo $client->formattedId($alphabet = '0123456789abcdefg', $size = 21,
new class implements GeneratorInterface {
/**
* @inheritDoc
*/
public function random($size)
{
//TODO: implemenation ...
}
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.