respect-validation/docs/rules/PublicDomainSuffix.md
Henrique Moody 48405271c5
Replace placeholder "name" with "subject"
The `{{name}}` placeholder could represent different things depending on
the state of the Result, and referring to it as `{{name}}` seems
arbitrary. This commit changes it to `{{subject}}`, which is much more
generic and it describes well what that placeholder can mean.
2025-12-26 21:30:01 +01:00

1.4 KiB

PublicDomainSuffix

  • PublicDomainSuffix()

Validates whether the input is a public ICANN domain suffix.

v::publicDomainSuffix->isValid('co.uk'); // true
v::publicDomainSuffix->isValid('CO.UK'); // true
v::publicDomainSuffix->isValid('nom.br'); // true
v::publicDomainSuffix->isValid('invalid.com'); // false

This rule will not match top level domains such as tk. If you want to match either, use a combination with Tld:

v::oneOf(v::tld(), v::publicDomainSuffix())->isValid('tk'); // true

Templates

PublicDomainSuffix::TEMPLATE_STANDARD

Mode Template
default {{subject}} must be a public domain suffix
inverted {{subject}} must not be a public domain suffix

Template placeholders

Placeholder Description
subject The validated input or the custom validator name (if specified).

Categorization

  • Internet

Changelog

Version Description
2.3.0 Created

See also: