PHPackages                             voku/php-domain-parser - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. voku/php-domain-parser

Abandoned → [jeremykendall/php-domain-parser](/?search=jeremykendall%2Fphp-domain-parser)Library[Utility &amp; Helpers](/categories/utility)

voku/php-domain-parser
======================

Fork: Public Suffix List based URL parsing implemented in PHP.

8.0.1(6y ago)7112.8k—0%3[1 PRs](https://github.com/voku/php-domain-parser/pulls)1MITPHPPHP &gt;=7.0.0

Since Jan 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/voku/php-domain-parser)[ Packagist](https://packagist.org/packages/voku/php-domain-parser)[ Docs](https://github.com/voku/php-domain-parser)[ RSS](/packages/voku-php-domain-parser/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependencies (5)Versions (48)Used By (1)

[![Build Status](https://camo.githubusercontent.com/2b993731fe311b909f166d3cbbd84c5a253ca59ba64415fb324de48a521b3167/68747470733a2f2f7472617669732d63692e6f72672f766f6b752f7068702d646f6d61696e2d7061727365722e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/voku/php-domain-parser)[![codecov.io](https://camo.githubusercontent.com/c971716f13312f767c91a05354e3e5a41ddea097d4e6c73794cf5ea63bbd386d/68747470733a2f2f636f6465636f762e696f2f6769746875622f766f6b752f7068702d646f6d61696e2d7061727365722f636f7665726167652e7376673f6272616e63683d646576656c6f70)](https://codecov.io/github/voku/php-domain-parser?branch=develop)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f3d80e790626ace9b827f0dccbd21a6c4c6c526a902eb00a2c9584a2c14ca543/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766f6b752f7068702d646f6d61696e2d7061727365722f6261646765732f7175616c6974792d73636f72652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/voku/php-domain-parser/?branch=develop)[![Codacy Badge](https://camo.githubusercontent.com/eaba8bd6014ccc506d945d4360ae5d652841378424b74bf8c9567b27713c161d/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3131366664333838323633313462613161333235663834643739666364633433)](https://www.codacy.com/app/voku/php-domain-parser)[![SensioLabsInsight](https://camo.githubusercontent.com/9d5f0df6f0b853741235fe5f0bbe138d8adb50673b22c8dcf85444117daa1e4d/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f33653931386465322d333035322d343238612d393230612d6535353466396234633532642f6d696e692e706e67)](https://insight.sensiolabs.com/projects/3e918de2-3052-428a-920a-e554f9b4c52d)[![Latest Stable Version](https://camo.githubusercontent.com/ace8281b3fe6439832179f77987e0e4eae29dce1c0a2fa16a270160bfd66cbcb/68747470733a2f2f706f7365722e707567782e6f72672f766f6b752f7068702d646f6d61696e2d7061727365722f762f737461626c65)](https://packagist.org/packages/voku/php-domain-parser)[![Total Downloads](https://camo.githubusercontent.com/0d72771e5f71e44af38e0792dab89573386d9c6433d280591780aff13b9ecb63/68747470733a2f2f706f7365722e707567782e6f72672f766f6b752f7068702d646f6d61696e2d7061727365722f646f776e6c6f616473)](https://packagist.org/packages/voku/php-domain-parser)[![Latest Unstable Version](https://camo.githubusercontent.com/b70ba2282cb0ffb7d04f64af3eb8f23c87cfc02469b1e3eff74e3536b04189b9/68747470733a2f2f706f7365722e707567782e6f72672f766f6b752f7068702d646f6d61696e2d7061727365722f762f756e737461626c65)](https://packagist.org/packages/voku/php-domain-parser)[![PHP 7 ready](https://camo.githubusercontent.com/5c94fd729e4e1b77adb3cfbbaa032f968c380cf4ef3eb2150677f39f67ca8911/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f766f6b752f7068702d646f6d61696e2d7061727365722f62616467652e737667)](https://travis-ci.org/voku/php-domain-parser)[![License](https://camo.githubusercontent.com/2fd4cf202d7f76cfebdf2e7293df65297d2e2664363f0737ac99d44c1ed83514/68747470733a2f2f706f7365722e707567782e6f72672f766f6b752f7068702d646f6d61696e2d7061727365722f6c6963656e7365)](https://packagist.org/packages/voku/php-domain-parser)

PHP Domain Parser
=================

[](#php-domain-parser)

WARNING: this is only a Fork of ""

**PHP Domain Parser** is a [Public Suffix List](http://publicsuffix.org/) based domain parser implemented in PHP.

Motivation
----------

[](#motivation)

While there are plenty of excellent URL parsers and builders available, there are very few projects that can accurately parse a url into its component subdomain, registrable domain, and public suffix parts.

Consider the domain [www.pref.okinawa.jp](http://www.pref.okinawa.jp). In this domain, the *public suffix* portion is **okinawa.jp**, the *registrable domain* is **pref.okinawa.jp**, and the *subdomain* is **www**. You can't regex that.

Other similar libraries focus primarily on URL building, parsing, and manipulation and additionally include public suffix domain parsing. PHP Domain Parser was built around accurate Public Suffix List based parsing from the very beginning, adding a URL object simply for the sake of completeness.

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

[](#installation)

The only (currently) supported method of installation is via [Composer](http://getcomposer.org).

Create a `composer.json` file in the root of your project:

```
{
    "require": {
        "voku/php-domain-parser": "~8.0"
    }
}
```

And then run: `composer install`

Add the autoloader to your project:

```
