Download the PHP package iliain/php-zoo-ids without Composer
On this page you can find all versions of the php package iliain/php-zoo-ids. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download iliain/php-zoo-ids
More information about iliain/php-zoo-ids
Files in iliain/php-zoo-ids
Package php-zoo-ids
Short Description A PHP version of bryanmylee's zoo-ids, originally written in JavaScript
License BSD-3-Clause
Homepage http://github.com/Iliain/php-zoo-ids
Informations about the package php-zoo-ids
php-zoo-ids
A PHP version of bryanmylee's zoo-ids, originally written in JavaScript, which was in turn inspired by the URL ID's of gfycat.com. For a frontend or backend that uses JavaScript, I highly recommend you use their package!
Generate predictable and unique identifiers composed of adjectives and animal names, with the ability to seed the random identifiers.
Range of IDs
Currently, there are 1347 adjectives and 221 animals. The more adjectives used, the more possible combinations of IDs available.
For a quick reference, with 2 adjectives used, there are 400,984,389 possible unique IDs.
With 3 adjectives, there are 540,125,971,983 possible unique IDs.
Installation
Usage
Examples
If you want to control the list of Nouns and Adjectives, you can provide your own:
Documentation
new UsernameRandomizer($adjectives, $nouns)
adjectives: array
An array of adjectives to use in generation. Defaults to preprovided list if none are specified.
nouns: array
An array of nouns to use in generation. Defaults to preprovided list if none are specified.
generateID($seed, $numAdjectives, $delimiter, $caseStyle)
seed: string|int
The seed used to generate the id. This allows us to generate predictable, but random and unique identifiers.
Defaults to the current time.
numAdjectives: int
The number of adjectives to use in the identifier.
Defaults to 2
.
delimiter: string
The delimiter used between words. The delimiter will also be used between multi-word adjectives.
Defaults to ''
.
caseStyle: string
The case style for the words. Possible options are 'titlecase'
, 'camelcase'
, 'uppercase'
, 'lowercase'
, and 'togglecase'
.
Defaults to 'titlecase'
.
Credits
All credit goes to Bryan Lee and his zoo-ids package. I wanted a version of this to use in PHP (username generation was handled by a PHP CMS), and converted the majority of his existing code to that format. Currently lacking some of his original features, such as the ability to use objects as seeds.