PHPackages                             geekwright/regdom - 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. geekwright/regdom

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

geekwright/regdom
=================

OO adaptation of Florian Sager's regdom library for querying Mozilla Public Suffix List

v1.0.9(3y ago)015.3k↓34.6%3[1 PRs](https://github.com/geekwright/RegDom/pulls)1Apache-2.0PHPPHP &gt;=5.3.9

Since Feb 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/geekwright/RegDom)[ Packagist](https://packagist.org/packages/geekwright/regdom)[ Docs](https://github.com/geekwright/RegDom)[ RSS](/packages/geekwright-regdom/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (2)Versions (13)Used By (1)

RegDom - Registered Domain Check in PHP
=======================================

[](#regdom---registered-domain-check-in-php)

Object oriented adaptation of Florian Sager's regdom library for querying Mozilla's Public Suffix List, complete with unit testing.

For more information of public suffixes, and why you may want to query the list, please see [publicsuffix.org](https://publicsuffix.org/)

Installation
============

[](#installation)

> composer require xoops/regdom

Usage
=====

[](#usage)

Class Xoops\\RegDom\\PublicSuffixList
-------------------------------------

[](#class-xoopsregdompublicsuffixlist)

This class handles all direct interaction with the public suffix list (PSL.) This includes, fetching the list from a source URL, caching that list locally, converting that list to a tree form to facilitate rapid lookup, and caching that tree in a serialized form.

### $psl = new PublicSuffixList(*$url*)

[](#psl--new-publicsuffixlisturl)

Creates a new PublicSuffixList object that will use the specified URL as the source of the PSL. If no *$url* is specified, it will default to [https://publicsuffix.org/list/public\_suffix\_list.dat](https://publicsuffix.org/list/public_suffix_list.dat)

### $psl-&gt;setURL(*$url*)

[](#psl-seturlurl)

Resets the current PSL, and uses the specified URL as the source.

### $psl-&gt;getTree()

[](#psl-gettree)

Returns the tree of the current PSL. `Xoops\RegDom\RegisteredDomain`uses this tree form for all lookups.

### $psl-&gt;clearDataDirectory(*$cacheOnly*)

[](#psl-cleardatadirectorycacheonly)

By default, this will clear all cached PSL data, including local copies of remotely accessed PSL data. Pass *true* for `$cacheOnly` to clear only the serialized tree data.

Class Xoops\\RegDom\\RegisteredDomain
-------------------------------------

[](#class-xoopsregdomregistereddomain)

This class can be used to determine the registrable domain portion of a URL, respecting the public suffix list conventions.

### $regdom = new RegisteredDomain(PublicSuffixList *$psl*)

[](#regdom--new-registereddomainpublicsuffixlist-psl)

Creates a new RegisteredDomain object that will use *$psl* to access the PSL. If no *$psl* is specified, a new PublicSuffixList object will be instantiated using default behaviors.

### $regdom-&gt;getRegisteredDomain(*$host*)

[](#regdom-getregistereddomainhost)

Returns the shortest registrable domain portion of the supplied *$host*, or *null* if the host could not be validly registered.

Examples: `echo $regdom->getRegisteredDomain('https://www.google.com/');`Outputs:

> google.com

`echo $regdom->getRegisteredDomain('theregister.co.uk');`Outputs:

> theregister.co.uk

`echo null === $regdom->getRegisteredDomain('co.uk');`Outputs:

> 1

script bin\\reloadpsl
---------------------

[](#script-binreloadpsl)

This script can be used to load a fresh copy of the PSL. It may be useful in cron job, or other scripted updates.

Credits
=======

[](#credits)

Reg-dom was written by Florian Sager, 2009-02-05,

Original code was published at

Marcus Bointon's adapted code is here

Original License
================

[](#original-license)

```
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to you under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 53.4% 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 ~227 days

Recently: every ~508 days

Total

11

Last Release

1114d ago

Major Versions

v0.1.0 → v1.0.02017-02-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/7eb0c56896d2405e44608ffb77c1411e4a18927be440b28275f7e0cb075ea9d6?d=identicon)[geekwright](/maintainers/geekwright)

---

Top Contributors

[![geekwright](https://avatars.githubusercontent.com/u/3181636?v=4)](https://github.com/geekwright "geekwright (39 commits)")[![mambax7](https://avatars.githubusercontent.com/u/613686?v=4)](https://github.com/mambax7 "mambax7 (30 commits)")[![Synchro](https://avatars.githubusercontent.com/u/81561?v=4)](https://github.com/Synchro "Synchro (4 commits)")

---

Tags

publictldsuffixregdom

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/geekwright-regdom/health.svg)

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

###  Alternatives

[jeremykendall/php-domain-parser

Public Suffix List and IANA Root Zone Database based Domain parsing implemented in PHP.

1.2k13.0M77](/packages/jeremykendall-php-domain-parser)[markbaker/tries

PHP Classes for Trie datastructures

211.6k](/packages/markbaker-tries)

PHPackages © 2026

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