class Illuminate / Validation / Rules / Password

Password

Implements

Uses

Properties

protected

$validator Validator

The validator performing the validation.

Default: null
protected

$data array

The data under validation.

Default: null
protected

$min int

The minimum size of the password.

Default: 8
protected

$mixedCase bool

If the password requires at least one uppercase and one lowercase letter.

Default: false
protected

$letters bool

If the password requires at least one letter.

Default: false
protected

$numbers bool

If the password requires at least one number.

Default: false
protected

$symbols bool

If the password requires at least one symbol.

Default: false
protected

$uncompromised bool

If the password should not have been compromised in data leaks.

Default: false
protected

$compromisedThreshold int

The number of times a password can appear in data leaks before being considered compromised.

protected

$customRules array

Additional validation rules that should be merged into the default rules during validation.

Default: []
protected

$messages array

The failure messages, if any.

Default: []
public static

$defaultCallback string|array|callable|null

The callback that will generate the "default" version of the password rule.

Default: null

Methods

public

__construct ( $min ) : void

Create a new rule instance.

Parameters

  • $min int
public static

defaults ( $callback ) : static|null

Set the default callback to be used for determining a password's default rules.

Parameters

  • $callback static|callable|null
public static

default ( ) : static

Get the default configuration of the password rule.

public static

required ( ) : array

Get the default configuration of the password rule and mark the field as required.

public static

sometimes ( ) : array

Get the default configuration of the password rule and mark the field as sometimes being required.

public

setValidator ( $validator ) : $this

Set the performing validator.

Parameters

public

setData ( $data ) : $this

Set the data under validation.

Parameters

  • $data array
public static

min ( $size ) : $this

Sets the minimum size of the password.

Parameters

  • $size int
public

uncompromised ( $threshold ) : $this

Ensures the password has not been compromised in data leaks.

Parameters

  • $threshold int
public

mixedCase ( ) : $this

Makes the password require at least one uppercase and one lowercase letter.

public

letters ( ) : $this

Makes the password require at least one letter.

public

numbers ( ) : $this

Makes the password require at least one number.

public

symbols ( ) : $this

Makes the password require at least one symbol.

public

rules ( $rules ) : $this

Specify additional validation rules that should be merged with the default rules during validation.

Parameters

  • $rules string|array
public

passes ( $attribute , $value ) : bool

Determine if the validation rule passes.

Parameters

  • $attribute string
  • $value mixed
public

message ( ) : array

Get the validation error message.

protected

getErrorMessage ( $key ) : string

Get the translated password error message.

Parameters

  • $key string
protected

fail ( $messages ) : bool

Adds the given failures, and return false.

Parameters

  • $messages array|string