Documentation

Password

Table of Contents

$alwaysReplaceChars  : array<string|int, mixed>|null
Map of characters that will always be replaced.
$consonants  : array<string|int, mixed>|null
Consonants to use. Can include locale specific letters.
$digits  : int
Number of digits to add to the end of the password.
$doubleConsonantsAfterVowel  : array<string|int, mixed>|null
Double consonants to use only if previous letter is a vowel
$doubleConsonantsAnywhere  : array<string|int, mixed>|null
Double consonants to use anywhere If null or empty, this will be populated by all entries from $double_consonants_first and $double_consonants_postvowel
$doubleConsonantsFirst  : array<string|int, mixed>|null
Double consonants to use only at the beginning of a password
$doubleVowelsAfterConsonant  : array<string|int, mixed>|null
Double vowels to use only if previous letter is a consonant
$doubleVowelsAnywhere  : array<string|int, mixed>|null
Double vowels to use anywhere If null or empty, this will be populated by all entries from $double_vowels_first and $double_vowels_postconsonant
$doubleVowelsFirst  : array<string|int, mixed>|null
Double vowels to use only at the beginning of a password
$maxLength  : int
Password maximum length
$minLength  : int
Password minimum length
$numSpecialChars  : int
Number of special characters in generated password.
$rareCharacters  : array<string|int, mixed>|null
Characters that will have a reduced chance of being used.
$rareCharactersChance  : int
The percentile chance of rare consonants being used If set to 0 the characters will never be used.
$specialChars  : array<string|int, mixed>|null
Special characters to use.
$vowels  : array<string|int, mixed>|null
Vowels to use. Can include locale specific letters.
$warpCharactersChance  : int
The percentile chance of characters being warped using $character_warp_map
$warpCharactersMap  : array<string|int, mixed>|null
Map of characters that can be replaced.
create()  : string
Static method to create a password using default configuration.
getAlwaysReplaceChars()  : array<string|int, string>
Get map of characters that will always be replaced.
getConsonants()  : array<string|int, string>
Get list of consonants used in password creation
getDigits()  : int
Get number of digits to add to end of password
getDoubleConsonantsAfterVowel()  : array<string|int, string>
Get the list of double consonants that will only be used after a vowel in a password.
getDoubleConsonantsAnywhere()  : array<string|int, string>
Get the list of double consonants that can be used anywhere in a password.
getDoubleConsonantsFirst()  : array<string|int, string>
Get the list of double consonants that will only be used in the beginning of a password.
getDoubleVowelsAfterConsonant()  : array<string|int, string>
Get the list of double vowels that will only be used after a consonant in a password.
getDoubleVowelsAnywhere()  : array<string|int, string>
Get the list of double vowels that can be used anywhere in a password.
getDoubleVowelsFirst()  : array<string|int, string>
Get the list of double vowels that will only be used in the beginning of a password.
getMaxLength()  : int
Set the maximum length of generated passwords.
getMinLength()  : int
Get the minimum length of generated passwords
getNumSpecialChars()  : int
Get number of special characters in a password.
getRareCharacters()  : array<string|int, string>
Get the list of rare characters that only has a percentage chance of being used.
getRareCharactersChance()  : int
Get the chance of rare characters being used
getSpecialChars()  : array<string|int, string>
Get list of special characters used in password creation
getVowels()  : array<string|int, string>
Get list of vowels used in password creation
getWarpCharactersChance()  : int
Get the percentile chance of characters being replaced as defined in $warpCharactersMap
getWarpCharactersMap()  : array<string|int, string>
Get the map of characters being warped (replaced).
setAlwaysReplaceChars()  : void
Set map of characters that will always be replaced.
setConsonants()  : void
Set list of consonants used in password creation
setDigits()  : void
Set number of digits to add to end of password.
setDoubleConsonantsAfterVowel()  : void
Set the list of double consonants that will only be used after a vowel in a password.
setDoubleConsonantsAnywhere()  : void
Set the list of double consonants that can be used anywhere in a password.
setDoubleConsonantsFirst()  : void
Set the list of double consonants that will only be used in the beginning of a password.
setDoubleVowelsAfterConsonant()  : void
Set the list of double vowels that will only be used after a consonant in a password.
setDoubleVowelsAnywhere()  : void
Set the list of double vowels that can be used anywhere in a password.
setDoubleVowelsFirst()  : void
Set the list of double vowels that will only be used in the beginning of a password.
setMaxLength()  : void
Set the maximum length of generated passwords.
setMinLength()  : void
Set the minimum length of generated passwords.
setNumSpecialChars()  : void
Set number of special characters in a password.
setRareCharacters()  : void
Set the list of rare characters that only has a percentage chance of being used.
setRareCharactersChance()  : void
Set the percentile chance of rare characters being used.
setSpecialChars()  : void
Set list of special characters used in password creation
setVowels()  : void
Set list of vowels used in password creation
setWarpCharactersChance()  : void
Set the percentile chance of characters being replaced as defined in $warpCharactersMap.
setWarpCharactersMap()  : void
Set the map of characters being warped (replaced).

Properties

$alwaysReplaceChars

Map of characters that will always be replaced.

private static array<string|int, mixed>|null $alwaysReplaceChars = array('O' => '0')

Case sensitive.

$consonants

Consonants to use. Can include locale specific letters.

private static array<string|int, mixed>|null $consonants = array('b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'z')

$digits

Number of digits to add to the end of the password.

private static int $digits = 2

0 or NULL = disabled

$doubleConsonantsAfterVowel

Double consonants to use only if previous letter is a vowel

private static array<string|int, mixed>|null $doubleConsonantsAfterVowel = array('ck', 'dv', 'fk', 'fp', 'fs', 'ft', 'gs', 'lb', 'lc', 'ld', 'lf', 'lg', 'lk', 'lm', 'ln', 'lp', 'ls', 'lv', 'lw', 'lz', 'md', 'mg', 'ml', 'mn', 'ms', 'mt', 'mx', 'nd', 'ng', 'nl', 'ns', 'nt', 'nx', 'pc', 'pk', 'px', 'rb', 'rd', 'rf', 'rm', 'rn', 'rp', 'rs', 'rv', 'rw', 'rz', 'tf', 'vc', 'vd', 'vg', 'vj', 'vl', 'vt', 'vx', 'vz', 'wd', 'wg', 'wt', 'wx', 'wz')

$doubleConsonantsAnywhere

Double consonants to use anywhere If null or empty, this will be populated by all entries from $double_consonants_first and $double_consonants_postvowel

private static array<string|int, mixed>|null $doubleConsonantsAnywhere = null

$doubleConsonantsFirst

Double consonants to use only at the beginning of a password

private static array<string|int, mixed>|null $doubleConsonantsFirst = array('bl', 'br', 'cl', 'cr', 'cv', 'dr', 'fl', 'fr', 'fs', 'fj', 'gl', 'gr', 'kl', 'kr', 'kj', 'kv', 'pl', 'pr', 'ps', 'pj', 'sc', 'sh', 'sk', 'sl', 'sm', 'sn', 'sp', 'st', 'sv', 'sw', 'tj', 'tr', 'ts', 'tv', 'tw', 'tz', 'vl', 'vr', 'wl', 'wr', 'zk', 'zl', 'zm', 'zn', 'zp', 'zt', 'zv')

$doubleVowelsAfterConsonant

Double vowels to use only if previous letter is a consonant

private static array<string|int, mixed>|null $doubleVowelsAfterConsonant = array('ia', 'ie', 'oe', 'ue', 'ui')

$doubleVowelsAnywhere

Double vowels to use anywhere If null or empty, this will be populated by all entries from $double_vowels_first and $double_vowels_postconsonant

private static array<string|int, mixed>|null $doubleVowelsAnywhere = null

$doubleVowelsFirst

Double vowels to use only at the beginning of a password

private static array<string|int, mixed>|null $doubleVowelsFirst = array('ai', 'au', 'ay', 'ei', 'eu', 'ey', 'io', 'iu', 'oi', 'ua', 'uo', 'ya', 'ye', 'yo', 'yu')

$maxLength

Password maximum length

private static int $maxLength = 12

$minLength

Password minimum length

private static int $minLength = 8

$numSpecialChars

Number of special characters in generated password.

private static int $numSpecialChars = 2

0 or NULL = disabled

$rareCharacters

Characters that will have a reduced chance of being used.

private static array<string|int, mixed>|null $rareCharacters = array('l', 'q', 'w', 'x', 'z')

The chance of these being used is defined by $rare_characters_chance Set to NULL or an empty array to disable. Will also be disabled if $rare_characters_chance is set to 100.

$rareCharactersChance

The percentile chance of rare consonants being used If set to 0 the characters will never be used.

private static int $rareCharactersChance = 30

If set to 100 this functionality will not be used.

$specialChars

Special characters to use.

private static array<string|int, mixed>|null $specialChars = array('!', '@', '#', '$', '%', '&', '*', '-', '+', '?')

$vowels

Vowels to use. Can include locale specific letters.

private static array<string|int, mixed>|null $vowels = array('a', 'e', 'i', 'o', 'u', 'y')

$warpCharactersChance

The percentile chance of characters being warped using $character_warp_map

private static int $warpCharactersChance = 75

$warpCharactersMap

Map of characters that can be replaced.

private static array<string|int, mixed>|null $warpCharactersMap = array('a' => '@', 'e' => '3', 'i' => '!', 'l' => '|', 'o' => '0', 's' => '$', 't' => '+', 'x' => '%', '7' => '/')

The percentile chance of each instance being replaced is defined by $warp_chance

Methods

create()

Static method to create a password using default configuration.

public static create([int $minLength = 8 ][, int $maxLength = 12 ]) : string
Parameters
$minLength : int = 8

Optional minimum password length, default 8

$maxLength : int = 12

Optional maximum password length, default 12

Return values
string

The generated pronounceable password.

getAlwaysReplaceChars()

Get map of characters that will always be replaced.

public static getAlwaysReplaceChars() : array<string|int, string>
Return values
array<string|int, string>

getConsonants()

Get list of consonants used in password creation

public static getConsonants() : array<string|int, string>
Return values
array<string|int, string>

getDigits()

Get number of digits to add to end of password

public static getDigits() : int
Return values
int

getDoubleConsonantsAfterVowel()

Get the list of double consonants that will only be used after a vowel in a password.

public static getDoubleConsonantsAfterVowel() : array<string|int, string>
Return values
array<string|int, string>

getDoubleConsonantsAnywhere()

Get the list of double consonants that can be used anywhere in a password.

public static getDoubleConsonantsAnywhere() : array<string|int, string>
Return values
array<string|int, string>

getDoubleConsonantsFirst()

Get the list of double consonants that will only be used in the beginning of a password.

public static getDoubleConsonantsFirst() : array<string|int, string>
Return values
array<string|int, string>

getDoubleVowelsAfterConsonant()

Get the list of double vowels that will only be used after a consonant in a password.

public static getDoubleVowelsAfterConsonant() : array<string|int, string>
Return values
array<string|int, string>

getDoubleVowelsAnywhere()

Get the list of double vowels that can be used anywhere in a password.

public static getDoubleVowelsAnywhere() : array<string|int, string>
Return values
array<string|int, string>

getDoubleVowelsFirst()

Get the list of double vowels that will only be used in the beginning of a password.

public static getDoubleVowelsFirst() : array<string|int, string>
Return values
array<string|int, string>

getMaxLength()

Set the maximum length of generated passwords.

public static getMaxLength() : int
Return values
int

getMinLength()

Get the minimum length of generated passwords

public static getMinLength() : int
Return values
int

getNumSpecialChars()

Get number of special characters in a password.

public static getNumSpecialChars() : int
Return values
int

getRareCharacters()

Get the list of rare characters that only has a percentage chance of being used.

public static getRareCharacters() : array<string|int, string>
Return values
array<string|int, string>

getRareCharactersChance()

Get the chance of rare characters being used

public static getRareCharactersChance() : int
Return values
int

getSpecialChars()

Get list of special characters used in password creation

public static getSpecialChars() : array<string|int, string>
Return values
array<string|int, string>

getVowels()

Get list of vowels used in password creation

public static getVowels() : array<string|int, string>
Return values
array<string|int, string>

getWarpCharactersChance()

Get the percentile chance of characters being replaced as defined in $warpCharactersMap

public static getWarpCharactersChance() : int
Return values
int

getWarpCharactersMap()

Get the map of characters being warped (replaced).

public static getWarpCharactersMap() : array<string|int, string>
Return values
array<string|int, string>

setAlwaysReplaceChars()

Set map of characters that will always be replaced.

public static setAlwaysReplaceChars(array<string|int, string> $alwaysReplaceChars) : void

The default is to always replace O (capital o) with 0 (zero)

Parameters
$alwaysReplaceChars : array<string|int, string>
Return values
void

setConsonants()

Set list of consonants used in password creation

public static setConsonants(array<string|int, string>|string $consonants) : void
Parameters
$consonants : array<string|int, string>|string

List of letters either as an array or a continuous string (like 'bcdfghjklmnpqrstvwxz')

Return values
void

setDigits()

Set number of digits to add to end of password.

public static setDigits(int $digits) : void

Set to 0 to disable.

Parameters
$digits : int
Return values
void

setDoubleConsonantsAfterVowel()

Set the list of double consonants that will only be used after a vowel in a password.

public static setDoubleConsonantsAfterVowel(array<string|int, string>|string $doubleConsonantsAfterVowel) : void
Parameters
$doubleConsonantsAfterVowel : array<string|int, string>|string

List of double letters either as an array or a space separated string (like 'bl br cl')

Return values
void

setDoubleConsonantsAnywhere()

Set the list of double consonants that can be used anywhere in a password.

public static setDoubleConsonantsAnywhere(array<string|int, string>|string $doubleConsonantsAnywhere) : void

If this is not set, it will be populated by all entries in $doubleConsonantsAfterVowel and $doubleConsonantsAnywhere

Parameters
$doubleConsonantsAnywhere : array<string|int, string>|string

List of double letters either as an array or a space separated string (like 'bl br cl')

Return values
void

setDoubleConsonantsFirst()

Set the list of double consonants that will only be used in the beginning of a password.

public static setDoubleConsonantsFirst(array<string|int, string>|string $doubleConsonantsFirst) : void
Parameters
$doubleConsonantsFirst : array<string|int, string>|string

List of double letters either as an array or a space separated string (like 'bl br cl')

Return values
void

setDoubleVowelsAfterConsonant()

Set the list of double vowels that will only be used after a consonant in a password.

public static setDoubleVowelsAfterConsonant(array<string|int, string>|string $doubleVowelsAfterConsonant) : void
Parameters
$doubleVowelsAfterConsonant : array<string|int, string>|string

List of double letters either as an array or a space separated string (like 'ai au eu')

Return values
void

setDoubleVowelsAnywhere()

Set the list of double vowels that can be used anywhere in a password.

public static setDoubleVowelsAnywhere(array<string|int, string>|string $doubleVowelsAnywhere) : void

If this is not set, it will be populated by all entries in $doubleVowelsAfterConsonant and $doubleVowelsAnywhere

Parameters
$doubleVowelsAnywhere : array<string|int, string>|string

List of double letters either as an array or a space separated string (like 'ai au eu')

Return values
void

setDoubleVowelsFirst()

Set the list of double vowels that will only be used in the beginning of a password.

public static setDoubleVowelsFirst(array<string|int, string>|string $doubleVowelsFirst) : void
Parameters
$doubleVowelsFirst : array<string|int, string>|string

List of double letters either as an array or a space separated string (like 'ai au eu')

Return values
void

setMaxLength()

Set the maximum length of generated passwords.

public static setMaxLength([int $maxLength = 12 ]) : void

Default is 12.

Parameters
$maxLength : int = 12
Tags
throws
Exception
Return values
void

setMinLength()

Set the minimum length of generated passwords.

public static setMinLength([int $minLength = 8 ]) : void

Default is 8.

Parameters
$minLength : int = 8
Tags
throws
Exception
Return values
void

setNumSpecialChars()

Set number of special characters in a password.

public static setNumSpecialChars(int $numSpecialChars) : void

Set to 0 to disable. Note that any special characters defined in alwaysReplaceMap or warpCharactersMap will not be affected by disabling this, but they will counted against the number set here.

Parameters
$numSpecialChars : int
Return values
void

setRareCharacters()

Set the list of rare characters that only has a percentage chance of being used.

public static setRareCharacters(array<string|int, string>|string $rareCharacters) : void
Parameters
$rareCharacters : array<string|int, string>|string

List of letters either as an array or a continuous string (like 'lqwxz')

Return values
void

setRareCharactersChance()

Set the percentile chance of rare characters being used.

public static setRareCharactersChance(int $rareCharactersChance) : void

Set to 0 to prevent rare characters from ever being used. Set to 100 to disable the functionality.

Parameters
$rareCharactersChance : int
Return values
void

setSpecialChars()

Set list of special characters used in password creation

public static setSpecialChars(array<string|int, string>|string $specialChars) : void
Parameters
$specialChars : array<string|int, string>|string
Return values
void

setVowels()

Set list of vowels used in password creation

public static setVowels(array<string|int, string>|string $vowels) : void
Parameters
$vowels : array<string|int, string>|string

List of letters either as an array or a continuous string (like 'aeiouy')

Return values
void

setWarpCharactersChance()

Set the percentile chance of characters being replaced as defined in $warpCharactersMap.

public static setWarpCharactersChance(int $warpCharactersChance) : void

Set to 0 to disable warping, set to 100 to always warp.

Parameters
$warpCharactersChance : int
Return values
void

setWarpCharactersMap()

Set the map of characters being warped (replaced).

public static setWarpCharactersMap(array<string|int, string> $warpCharactersMap) : void
Parameters
$warpCharactersMap : array<string|int, string>
Return values
void

Search results