Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
umpirsky committed Jan 16, 2016
0 parents commit 2820e4c
Show file tree
Hide file tree
Showing 16 changed files with 9,482 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) Saša Stamenković <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
TLD List
========

Formats Available
-----------------

- Text
- JSON
- YAML
- XML
- HTML
- CSV
- SQL
* MySQL
* PostgreSQL
* SQLite
- PHP

Build
-----

Currency list is available out of the box, but if you want to submit patches, add new formats,
update data source or contribute in any other way, you will probably want to rebuild the list:

```bash
$ composer install
$ ./bin/build
```

Other Interesting Lists
-----------------------

* [Country List](https://github.com/umpirsky/country-list)
* [Currency List](https://github.com/umpirsky/currency-list)
* [Language List](https://github.com/umpirsky/language-list)
* [Locale List](https://github.com/umpirsky/locale-list)
35 changes: 35 additions & 0 deletions bin/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env php
<?php

include __DIR__ . '/../vendor/autoload.php';

class Tld extends Umpirsky\ListGenerator\Importer\Importer
{
public function getLanguages()
{
return ['en'];
}

public function getData($language)
{
$data = explode(
PHP_EOL,
file_get_contents('https://data.iana.org/TLD/tlds-alpha-by-domain.txt')
);
array_shift($data);
array_pop($data);

$tlds = [];
foreach ($data as $tld) {
$tld = strtolower($tld);
$tlds[$tld] = idn_to_utf8($tld);
}

return $tlds;
}
}

(new Umpirsky\ListGenerator\Builder\Builder(
new Tld(),
__DIR__.'/../data'
))->run();
18 changes: 18 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "umpirsky/tld-list",
"type": "library",
"description": "List of all top-level domains in all data formats.",
"license": "MIT",
"authors": [
{
"name": "Saša Stamenković",
"email": "[email protected]"
}
],
"require": {
"php": ">=5.4"
},
"require-dev": {
"umpirsky/list-generator": "^1.1"
}
}
Loading

0 comments on commit 2820e4c

Please sign in to comment.