Skip to main content

E164Validator

Class E164Validator

Validates phone numbers against E.164 format using territory-based rules extracted from the Google's libphonenumber library.

Since: 2.9.0

Source: includes/validation/class-e164-validator.php:13

Details

  • Kind: class
  • Namespace: (global)

Methods

MethodDescription
__construct()E164Validator constructor.
validate()Validates a phone number against E.164 format and territory-specific rules.

Method Reference

__construct()

public function __construct()

E164Validator constructor.

Since: 2.9.0

Source: includes/validation/class-e164-validator.php:41

validate()

public function validate( $phone_number, $detailed=false )

Validates a phone number against E.164 format and territory-specific rules.

Parameters

NameTypeDefaultDescription
$phone_numberstringThe phone number to validate in E.164 format.
$detailedboolfalseWhether to return detailed validation information. Defaults to false.

Returns

  • bool | array — Returns boolean validation result or detailed array if $detailed is true.

Since: 2.9.0

Source: includes/validation/class-e164-validator.php:61