class Email implements Rule, DataAwareRule, ValidatorAwareRule (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
$validateMxRecord | |||
$preventSpoofing | |||
$nativeValidation | |||
$nativeValidationWithUnicodeAllowed | |||
$rfcCompliant | |||
$strictRfcCompliant | |||
protected Validator | $validator | The validator performing the validation. |
|
protected array | $data | The data under validation. |
|
protected array | $customRules | An array of custom rules that will be merged into the validation rules. |
|
protected array | $messages | The error message after validation, if any. |
|
static string|array|callable|null | $defaultCallback | The callback that will generate the "default" version of the file rule. |
Methods
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Ensure that the email is an RFC compliant email address.
Ensure that the email is a strictly enforced RFC compliant email address.
Ensure that the email address has a valid MX record.
Ensure that the email address is not attempting to spoof another email address using invalid unicode characters.
Ensure the email address is valid using PHP's native email validation functions.
Specify additional validation rules that should be merged with the default rules during validation.
Determine if the validation rule passes.
Build the array of underlying validation rules based on the current state.
Get the validation error message.
Set the current data under validation.
Details
$this|TWhenReturnType
when($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
$this|TUnlessReturnType
unless($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
static Email|void
defaults(Email|callable|null $callback = null)
Set the default callback to be used for determining the email default rules.
If no arguments are passed, the default email rule configuration will be returned.
$this
validateMxRecord()
Ensure that the email address has a valid MX record.
Requires the PHP intl extension.
$this
preventSpoofing()
Ensure that the email address is not attempting to spoof another email address using invalid unicode characters.
$this
withNativeValidation(bool $allowUnicode = false)
Ensure the email address is valid using PHP's native email validation functions.
$this
rules(string|array $rules)
Specify additional validation rules that should be merged with the default rules during validation.