Projects / libtld


libtld is a library used to extract the TLD from a URI and to check email validity. This allows you to extract the exact domain name, sub-domains, and all the TLD (top level, second level, third level, etc.). The problem with TLDs is that you cannot know where the domain starts. Some domains can use one top-level domain, others use two, etc. However, it may be useful to know where the domain is to have the exact list of sub-domains. For example, if you want to force www. at the start of the domain name if no other sub-domains are specified, then you need to know exactly how many TLD are defined in a URI. The libtld offers one main function: tld(), which gives you a way to extract the TLD from any URI. The result is the offset where the TLD starts. This gives you enough information to extract everything else you need. For emails, the library is capable of parsing a string that represents a list of email addresses to be verified. The verification includes a check of the domain name and its TLD.

Operating Systems

Recent releases

  •  05 May 2014 02:51

    Release Notes: This release adds new gTLDs as defined by the INA. It adds a "brand" category. It adds a test to verify all the extensions offered by GoDaddy. It adds a script to build the source using the Debian tool dpkg-source. It adds some documentation in different files (INSTALL.txt, README). It updates the coverage test to work in the new environment. It fixes the copyright notice with 2014. It bumps the version in the CMakeLists.txt to the correct version (as per the changelog).

    •  21 Nov 2013 22:40

      Release Notes: This release mainly streamlines the license information of the module, adding a Debian compatible copyright file to the debian directory and /usr/share/doc/libtld on install. It also includes a new set of cmake files; although at this point they're still shipped as part of this project, at some point these cmake scripts will become a separate project.

      •  24 Aug 2013 21:54

        Release Notes: This is a patch with the few new TLDs added in the last few months.

        •  28 May 2013 16:20

          Release Notes: This version adds a strong email check in C, C++, and PHP. It also strengthen the documentation and restructures the project environment with 100% coverage by the unit tests.

          •  18 Feb 2013 03:26

            Release Notes: This release adds a C++ class to easily handle URIs in C++, adds a PHP extension so [check_]tld() can be used in PHP, adds a static version of the library, updates the TLDs as of Feb 2013, and fixes the TLD exceptions, which now return a valid answer.


            Project Spotlight


            A Fluent OpenStack client API for Java.


            Project Spotlight

            TurnKey TWiki Appliance

            A TWiki appliance that is easy to use and lightweight.