PHP code example of biohzrdmx / humanids-php

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

    

biohzrdmx / humanids-php example snippets


use Humanids\Generator;
use Humanids\Tokens\AdjectiveToken;
use Humanids\Tokens\AnimalToken;
use Humanids\Tokens\NumberToken;

$tokens = [
    new AdjectiveToken(),
    new AnimalToken(),
    new NumberToken(1, 100, 3),
];
$generator = new Generator($tokens);
$identifier = $generator->generate();

use Humanids\Generator;
use Humanids\Tokens\AdjectiveToken;
use Humanids\Tokens\AnimalToken;
use Humanids\Tokens\FixedToken;
use Humanids\Tokens\NumberToken;
use Humanids\Tokens\StringToken;

$tokens = [
    new FixedToken('ec2'),
    new AdjectiveToken(),
    new AnimalToken(),
    new NumberToken(1, 999, 3),
    new StringToken(4, 'abcdefghijklmnopqrstuvwxyz'),
];
$generator = new Generator($tokens);