This class can be used to validate a password or password like string to certain standards. These can be things like having more than one letter, or having at least a single number.
The class can also be used to "score" a password to certain parameters.
category |
Password |
---|---|
package |
Password |
author |
Philip Norton philipnorton42@gmail.com |
license |
http://www.gnu.org/copyleft/gpl.html GNU General Public License |
version |
Release: 1.0 04/09/2009 |
link |
https://github.com/philipnorton42/PHP-Password |
Password(array $options = array())
array
An associative array of options.
validatePassword(string $password) : boolean
string
The password.
boolean
True if password valid, otherwise false.
scorePassword(string $password) : mixed
The function first makes sure the password is valid as there is no point in scoring a password that can't be used.
string
The password to score.
mixed
Returns an integer score of the password strength.
generatePassword() : string
string
The generated password.
setOptions(array $options) : null
array
An associative array of options.
null
getErrors() : array
array
setMaxLength(integer $maxLength) : null
integer
The maximum length of password allowed.
null
getMaxLength() : integer
integer
The maximum character length of the password.
setMinLength(integer $minLength) : null
integer
The minimum length of password allowed.
null
getMinLength() : integer
integer
The minimum character length of the password.
getAllowedSymbols() : array
array
The allowed symbols array.
setAllowedSymbols(array $symbols) : null
array
An array of symbols that can be included in the password.
null
setMinSymbols(integer $minSymbols) : null
integer
The minimum number of symbols.
null
getMinSymbols() : integer
integer
The minimum number of symbols.
setMaxSymbols(integer $maxSymbols) : null
integer
The maximum number of symbols.
null
getMaxSymbols() : integer
integer
The maximum number of symbols allowed in the password.
_sanitizeInputs() : null
null
errors
var |
Holds an array of any errors encountered whilst validating the password. |
---|---|
minLength
var |
The minimum number of characters that the password must be. |
---|---|
maxLength
var |
The maximum number of characters that the password must be. |
---|---|
minNumbers
var |
The minimum number of numbers that the password should contain. |
---|---|
minLetters
var |
The minimum number of letters that the password should contain. |
---|---|
minLowerCase
var |
The minimum number of lower case letters that the password should contain. |
---|---|
minUpperCase
var |
The minimum number of upper case letters that the password should contain. |
---|---|
minSymbols
var |
The minimum number of symbols that the password should contain. |
---|---|
maxSymbols
var |
The maximum number of symbols that the password should contain. |
---|---|
allowedSymbols
var |
The symbols that are allowed to be in the password. |
---|---|
score
var |
The score of the password. |
---|---|