# TLD Enumerations Lists of every [IANA TLD](http://data.iana.org/TLD/tlds-alpha-by-domain.txt) in various formats. The lists may be continuously updated using the [included utility](#updating-the-tld-lists) that pulls the latest data from IANA. * [CSV format](./tlds.csv) * [All Formats](#tld-list-formats) * [Updating the TLDs](#updating-the-tld-lists) * [Node Usage](#node-usage) * [PHP Usage](#php-usage) ## Usage Because the lists are provided in universial CSV and JSON formats, they can be easily utilitized in most programming environments. Additionally, for convenience, some native programming language formats have also been provided. * [Node Usage](#node-usage) * [PHP Usage](#php-usage) ### Node Usage * use npm to add the `tld-enum` package to your project ```sh $ npm install tld-enum --save ``` * add the module to your source ```js const tldEnum = require('tld-enum'); ``` * access the list by using the `tldEnum.tldList` array ```js const tldEnum = require('tld-enum'); tldEnum.tldList; //an array with every IANA TLD ``` The following example... ```js const tldEnum = require('tld-enum'); console.log("There are " + tldEnum.tldList.length + " IANA TLDs"); let tldCheck; tldCheck = "com"; console.log("Is '" + tldCheck + "' a real TLD?"); if (tldEnum.tldList.indexOf(tldCheck.toLowerCase()) != -1) { console.log(" yes"); } else { console.log(" no"); } tldCheck = "somethingWeird"; console.log("Is '" + tldCheck + "' a real TLD?"); if (tldEnum.tldList.indexOf(tldCheck.toLowerCase()) != -1) { console.log(" yes"); } else { console.log(" no"); } ``` Should produce the following output... ```txt There are 1573 IANA TLDs Is 'com' a real TLD? yes Is 'somethingWeird' a real TLD? no ``` ### PHP Usage * use composer to add the `katmore/tld-enum` package to your project ```sh $ composer require katmore/tld-enum ``` * access the list by using the `\TldEnum\TldEnum::TLD_ENUM` class constant array ```php