PHPackages                             toxic-lemurs/domain-helper - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. toxic-lemurs/domain-helper

ActiveLibrary[HTTP &amp; Networking](/categories/http)

toxic-lemurs/domain-helper
==========================

A domain helper to aid in getting sub domain names and protocols.

1.0.2(10y ago)3671MITPHPPHP &gt;=5.5.9

Since Oct 5Pushed 10y ago1 watchersCompare

[ Source](https://github.com/ToxicLemurs/DomainHelper)[ Packagist](https://packagist.org/packages/toxic-lemurs/domain-helper)[ Docs](https://github.com/ToxicLemurs/DomainHelper)[ RSS](/packages/toxic-lemurs-domain-helper/feed)WikiDiscussions master Synced 1mo ago

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

A simple helper to aid with determining sub domain names, root domains and protocols
------------------------------------------------------------------------------------

[](#a-simple-helper-to-aid-with-determining-sub-domain-names-root-domains-and-protocols)

This helper will aid in determining sub domain names, root domains and protocols (http / https) with optional Laravel integration.

Installation:
-------------

[](#installation)

Require this package in your composer.json and update composer. This will download the package and all the dependencies:

```
"toxic-lemurs/domain-helper": "1.*"

```

Alternatively you can require this through composer via the command line:

```
$ composer require toxic-lemurs/domain-helper

```

### Laravel 5.x:

[](#laravel-5x)

Run a composer update and add the following Service Provider in your config/app.php

```
ToxicLemurs\DomainHelper\DomainHelperServiceProvider::class,

```

You can make use of the Facade feature in Laravel:

```
'DomainHelper' => ToxicLemurs\DomainHelper\Facades\DomainHelper::class,

```

Getting started and usage:
--------------------------

[](#getting-started-and-usage)

You can use the Facade in Laravel to call various methods on this helper:

```
DomainHelper::getDomainName();

```

Or you can instantiate an instance of the Domain Helper class:

```
$domainHelper = new \ToxicLemurs\DomainHelper\DomainHelper();
$domainHelper->getDomainName();

```

You can override the Server Name as returned by HTTP\_HOST:

```
$domainHelper = new \ToxicLemurs\DomainHelper\DomainHelper();
$domainHelper->setServerName('foo.example.com');
$domainHelper->getDomainName();

```

To get the sub domain name(s):

```
$domainHelper = new \ToxicLemurs\DomainHelper\DomainHelper();
$domainHelper->getSubDomainNames();

OR

DomainHelper::getSubDomainNames();

```

You can either get a string or an array result back for the sub domains:

```
$domainHelper = new \ToxicLemurs\DomainHelper\DomainHelper();
$domainHelper->setServerName('foo.bar.example.com');
$domainHelper->getSubDomainNames(true);

OR

DomainHelper::getSubDomainNames(true);

Will return:

    array:2 [
        0 => "foo"
        1 => "bar"
    ]

```

You can check if the domain you are currently on is the root domain:

```
$domainHelper = new \ToxicLemurs\DomainHelper\DomainHelper();
$domainHelper->isRoot();

OR

DomainHelper::isRoot();

```

You can get the current request protocol:

```
$domainHelper = new \ToxicLemurs\DomainHelper\DomainHelper();
$domainHelper->getProtocol();

OR

DomainHelper::getProtocol();

```

### License:

[](#license)

This Domain Helper is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~27 days

Total

4

Last Release

3792d ago

Major Versions

0.0.1 → 1.0.02015-10-05

### Community

Maintainers

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

---

Top Contributors

[![ToxicLemurs](https://avatars.githubusercontent.com/u/14289728?v=4)](https://github.com/ToxicLemurs "ToxicLemurs (4 commits)")

---

Tags

httpphphttpslaravelhelperprotocolSimplesecurefacadedomain

### Embed Badge

![Health badge](/badges/toxic-lemurs-domain-helper/health.svg)

```
[![Health](https://phpackages.com/badges/toxic-lemurs-domain-helper/health.svg)](https://phpackages.com/packages/toxic-lemurs-domain-helper)
```

###  Alternatives

[dragon-code/laravel-http-logger

Logging incoming HTTP requests

319.8k3](/packages/dragon-code-laravel-http-logger)[sockeon/sockeon

Framework-agnostic PHP WebSocket and HTTP server library with attribute-based routing and support for namespaces and rooms.

291.3k2](/packages/sockeon-sockeon)[akhan619/laravel-ses-tracking

A Laravel artisan based package to create the AWS (SES + SNS) infrastructure to receive email event notifications with Http/Https endpoint.

149.9k](/packages/akhan619-laravel-ses-tracking)[akhan619/laravel-ses-event-manager

A Laravel package to manage incoming SES email events with http/s webhooks.

148.8k](/packages/akhan619-laravel-ses-event-manager)[josantonius/url

PHP library to access URL information.

123.2k2](/packages/josantonius-url)

PHPackages © 2026

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