Skip to content
Pieter Hordijk edited this page Dec 30, 2018 · 1 revision

TOC

NativeEmailAddress

Validates the input (string) to be a valid email address according to PHP's native email validation rules.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\Email\NativeEmailAddress;

(new NativeEmailAddress())->validate('[email protected]');

Failure reasons

  • Type.String when the validated value is not a string
  • Email.NativeEmailAddress when the validated value is not a valid email address

RfcEmailAddress

Validates the input (string) to be a valid email address according to more RFCs than PHP's native email validation. Uses egulias/EmailValidator to validate email addresses.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\Email\RfcEmailAddress;

(new RfcEmailAddress())->validate('[email protected]');

Failure reasons

  • Type.String when the validated value is not a string
  • Email.RfcEmailAddress when the validated value is not a valid email address
Clone this wiki locally