Password
Implements
Uses
Properties
$data array
The data under validation.
$min int
The minimum size of the password.
$mixedCase bool
If the password requires at least one uppercase and one lowercase letter.
$letters bool
If the password requires at least one letter.
$numbers bool
If the password requires at least one number.
$symbols bool
If the password requires at least one symbol.
$uncompromised bool
If the password should not have been compromised in data leaks.
$compromisedThreshold int
The number of times a password can appear in data leaks before being considered compromised.
$customRules array
Additional validation rules that should be merged into the default rules during validation.
$messages array
The failure messages, if any.
$defaultCallback string|array|callable|null
The callback that will generate the "default" version of the password rule.
Methods
__construct ( $min ) : void
Create a new rule instance.
Parameters
- $min int
defaults ( $callback ) : static|null
Set the default callback to be used for determining a password's default rules.
Parameters
- $callback static|callable|null
default ( ) : static
Get the default configuration of the password rule.
required ( ) : array
Get the default configuration of the password rule and mark the field as required.
sometimes ( ) : array
Get the default configuration of the password rule and mark the field as sometimes being required.
setValidator ( $validator ) : $this
Set the performing validator.
Parameters
- $validator Validator
setData ( $data ) : $this
Set the data under validation.
Parameters
- $data array
min ( $size ) : $this
Sets the minimum size of the password.
Parameters
- $size int
uncompromised ( $threshold ) : $this
Ensures the password has not been compromised in data leaks.
Parameters
- $threshold int
mixedCase ( ) : $this
Makes the password require at least one uppercase and one lowercase letter.
letters ( ) : $this
Makes the password require at least one letter.
numbers ( ) : $this
Makes the password require at least one number.
symbols ( ) : $this
Makes the password require at least one symbol.
rules ( $rules ) : $this
Specify additional validation rules that should be merged with the default rules during validation.
Parameters
- $rules string|array
passes ( $attribute , $value ) : bool
Determine if the validation rule passes.
Parameters
- $attribute string
- $value mixed
message ( ) : array
Get the validation error message.
getErrorMessage ( $key ) : string
Get the translated password error message.
Parameters
- $key string
fail ( $messages ) : bool
Adds the given failures, and return false.
Parameters
- $messages array|string