PHP domain-parser Validators for the Symfony Validator component

v1.0.1 2023-11-03 14:09 UTC

This package is auto-updated.

Last update: 2024-04-27 11:33:01 UTC


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 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.

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.

Basic Usage

Validators Set-up

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 option allowPrivate which specifies if private-prefixes (like are allowed. Default is false.

  • The DomainNameSuffix constraint has one specific option requireICANN which configures whether the effective TLD requires a matching rule in a Public Suffix List ICANN Section. Default is true.

    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:


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


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.