A PHP library for parsing domain names into subdomain, registrable domain, second-level domain, and public suffix components using the Public Suffix List and IANA TLD List.
PHP Domain Parser is a PHP library that accurately parses domain names into components like subdomain, registrable domain, second-level domain, and public suffix. It solves the problem of incorrect domain parsing by using authoritative sources like the Public Suffix List and IANA TLD List, ensuring reliable handling of complex or new gTLDs.
PHP developers building applications that require precise domain name manipulation, such as URL analyzers, security tools, CMS platforms, or any system validating or processing domain names.
Developers choose PHP Domain Parser for its strict compliance with official domain standards, avoiding regex-based guesswork. Its integration with caching mechanisms and support for IDNA make it a robust, production-ready solution for domain parsing.
Public Suffix List based domain parsing implemented in PHP
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses the Public Suffix List and IANA TLD List for accurate parsing, avoiding regex guesswork and correctly handling complex domains like www.pref.okinawa.jp.
Supports both IDNA2008 and IDNA2003 algorithms via ASCII/Unicode conversion, with optional intl extension or polyfills for Internationalized Domain Names.
Includes optional PSR-compliant storage utilities for caching external lists, reducing network overhead and improving performance in production environments.
Provides a ResolvedDomain object with methods to access subdomain, registrable domain, second-level domain, and suffix components, enabling precise manipulation.
Offers methods like getICANNDomain that throw exceptions for invalid or unmatched domains, ensuring data integrity and compliance with standards.
Requires manual setup and updating of Public Suffix List and IANA TLD List data, with no built-in auto-update mechanism, adding maintenance overhead.
Needs the intl extension or a polyfill like symfony/polyfill-intl-idn for IDN handling, which can complicate deployment in constrained environments.
Setting up caching with PSR interfaces involves multiple components (cache, HTTP client, factory), making it daunting for simple use cases without prior experience.
Version upgrades, such as to 6.4, require cache refreshes and have documented issues in UPGRADING.md, necessitating careful migration planning.