Checks whether a password matches some expected policy.
public static checkPasswordPolicy ( string $password, array $policy ) | ||
$password | string | A password. |
$policy | array | A configuration with policy rules. Supported rules: - minLength: Minimum length of the password - maxLength: Maximum length of the password - maxSpace: Maximum number of white space characters The following are the types of characters required in a password. Either specific characters, character classes, or both can be required. Specific types are: - minUpper: Minimum number of uppercase characters - minLower: Minimum number of lowercase characters - minNumeric: Minimum number of numeric characters (0-9) - minAlphaNum: Minimum number of alphanumeric characters - minAlpha: Minimum number of alphabetic characters - minSymbol: Minimum number of punctuation / symbol characters - minNonAlpha: Minimum number of non-alphabetic characters Alternatively (or in addition to), the minimum number of character classes can be configured by setting the following. The valid range is 0 through 4 character classes may be required for a password. The classes are: 'upper', 'lower', 'number', and 'symbol'. For example: A password of 'p@ssw0rd' satisfies three classes ('number', 'lower', and 'symbol'), while 'passw0rd' only satisfies two classes ('lower' and 'number'). - minClasses: Minimum number (0 through 4) of character classes. |