PHPackages                             whoisdoma/domainparser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. whoisdoma/domainparser

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

whoisdoma/domainparser
======================

A domain name parser to parse and to validate a domain name.

1.0.0(5y ago)43.4k2[1 issues](https://github.com/Whoisdoma/DomainParser/issues)2MITPHP

Since Dec 31Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Whoisdoma/DomainParser)[ Packagist](https://packagist.org/packages/whoisdoma/domainparser)[ Docs](https://github.com/Whoisdoma/DomainParser/)[ RSS](/packages/whoisdoma-domainparser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (3)Used By (2)

Whoisdoma Domain Parser
=======================

[](#whoisdoma-domain-parser)

A domain name parser to parse and to validate a domain name.

At first it will parse a given string to split it by the hostname and top-level domain name. This will be done with a list from Mozilla and we also added some missing second-level domain names. Afterwards we will convert the domain name to it punycode and unicode notation. If an error occures by doing so, e.g. characters that are not allowed. It will kill these characters and set a flag to false. This flag is used for the validation.

Copyright (c) 2016 XAOS Interactive () | Whoisdoma ()

Licensed under the MIT License (the "License").

Installation
------------

[](#installation)

Installing using composer: `composer require whoisdoma/domainparser`

Installing from source: `git clone git://github.com/Whoisdoma/DomainParser.git` or [download the latest release](https://github.com/Whoisdoma/DomainParser/zipball/master)

Move the source code to your preferred project folder.

Usage
-----

[](#usage)

- Include Parser.php

```
require_once 'DomainParser/Parser.php';

```

- or if using composer:

```
use Whoisdoma\DomainParser\Parser;

```

- Create Parser() object

```
$Parser = new Whoisdoma\DomainParser\Parser();

```

- Call parse() method

```
$result = $Parser->parse($string);

```

- Please note, if the given string doesn't contain a domain name the default tld .com will be added to the query. You may change this by adding a tld to the parse method call.

```
$result = $Parser->parse($string, $yourPreferredDefaultTld);

```

- You may choose 5 different return types. the types are array, object, json, serialize and xml. By default it is object. If you want to change that call the format method before calling the parse method or provide to the constructer. If you are not using object and an error occurs, then exceptions will not be trapped within the response and thrown directy.

```
$Parser->setFormat('json');
$Parser = new Whoisdoma\DomainParser\Parser('json');

```

3rd Party Libraries
-------------------

[](#3rd-party-libraries)

Thanks to developers of following used libraries:

- phlyLabs:
- mozilla:

ChangeLog
---------

[](#changelog)

See ChangeLog at

Issues
------

[](#issues)

Please report any issues via

LICENSE and COPYRIGHT
---------------------

[](#license-and-copyright)

Copyright (c) 2016 XAOS Interactive () | Whoisdoma ()

License:

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance25

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1964d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1b6f46fdeb33fa12ddc9f44031172e13beaf5804850761dd067abd8736c586b?d=identicon)[xaoseric](/maintainers/xaoseric)

---

Top Contributors

[![xaoseric](https://avatars.githubusercontent.com/u/643544?v=4)](https://github.com/xaoseric "xaoseric (15 commits)")[![dwilbanks](https://avatars.githubusercontent.com/u/6603303?v=4)](https://github.com/dwilbanks "dwilbanks (1 commits)")

---

Tags

phpdomaindomainparser

### Embed Badge

![Health badge](/badges/whoisdoma-domainparser/health.svg)

```
[![Health](https://phpackages.com/badges/whoisdoma-domainparser/health.svg)](https://phpackages.com/packages/whoisdoma-domainparser)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
