This package provides public domain-suffix and top-level domain validators for the Symfony Validator component.
Allowing to validate the following (per constraint):
-
If the domain-name is registrable (you cannot register name.github.io as this is a public-suffix managed by GitHub for example, and you cannot use custom TLDs;
-
If the public-suffix of domain name is valid;
Note: These constraints are used by the Rollerworks X509Validator to ensure no invalid hostnames are used in the Certificate's subject.
To install this package, add rollerworks/pdb-validator
to your composer.json:
$ php composer.phar require rollerworks/pdb-validator
Now, Composer will automatically download all required files, and install them for you.
Symfony Flex (with contrib) is assumed to enable the Bundle and add required configuration. https://symfony.com/doc/current/bundles.html
Otherwise enable the Rollerworks\Component\PdbValidator\Bundle\RollerworksPdbValidatorBundle
and the Rollerworks\Component\PdbSfBridge\Bundle\RollerworksPdbBundle
Note: Don't forget to configure the RollerworksPdbBundle
.
You need at least PHP 8.1, and configure the PdbManager as provided by Rollerworks PdbSfBridge.
The Validators need to be registered with a ConstraintValidatorFactory, the bundle is already ready to use.
Both the DomainNameRegistrableValidator
and DomainNameSuffixValidator
require a Rollerworks\Component\PdbSfBridge\PdpManager
instance
is passed to their constructor.
-
The
DomainNameRegistrable
constraint has one specific optionallowPrivate
which specifies if private-prefixes (like github.io) are allowed. Default isfalse
. -
The
DomainNameSuffix
constraint has one specific optionrequireICANN
which configures whether the effective TLD requires a matching rule in a Public Suffix List ICANN Section. Default istrue
.When set to
false
the suffix is still required to exist.
For transparency and insight into the release cycle, and for striving to maintain backward compatibility, this package is maintained under the Semantic Versioning guidelines as much as possible.
Releases will be numbered with the following format:
<major>.<minor>.<patch>
And constructed with the following guidelines:
- Breaking backward compatibility bumps the major (and resets the minor and patch)
- New additions without breaking backward compatibility bumps the minor (and resets the patch)
- Bug fixes and misc changes bumps the patch
For more information on SemVer, please visit http://semver.org/.
This library is released under the MIT license.
This is an open source project. If you'd like to contribute, please read the Contributing Guidelines. If you're submitting a pull request, please follow the guidelines in the Submitting a Patch section.