2017 © Pedro Peláez
 

library domain-helper

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

image

toxic-lemurs/domain-helper

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

  • Thursday, December 24, 2015
  • by ToxicLemurs
  • Repository
  • 1 Watchers
  • 2 Stars
  • 22 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

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., (*1)

Installation:

Require this package in your composer.json and update composer. This will download the package and all the dependencies:, (*2)

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

Alternatively you can require this through composer via the command line:, (*3)

$ composer require toxic-lemurs/domain-helper

Laravel 5.x:

Run a composer update and add the following Service Provider in your config/app.php, (*4)

ToxicLemurs\DomainHelper\DomainHelperServiceProvider::class,

You can make use of the Facade feature in Laravel:, (*5)

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

Getting started and usage:

You can use the Facade in Laravel to call various methods on this helper:, (*6)

DomainHelper::getDomainName();

Or you can instantiate an instance of the Domain Helper class:, (*7)

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

You can override the Server Name as returned by HTTP_HOST:, (*8)

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

To get the sub domain name(s):, (*9)

$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:, (*10)

$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:, (*11)

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

OR

DomainHelper::isRoot();

You can get the current request protocol:, (*12)

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

OR

DomainHelper::getProtocol();

License:

This Domain Helper is open-sourced software licensed under the MIT license, (*13)

The Versions

24/12 2015

dev-master

9999999-dev https://github.com/ToxicLemurs/DomainHelper

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

  Sources   Download

MIT

The Requires

 

laravel https domain php helper http simple secure facade protocol

24/12 2015

1.0.2

1.0.2.0 https://github.com/ToxicLemurs/DomainHelper

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

  Sources   Download

MIT

The Requires

 

laravel https domain php helper http simple secure facade protocol

05/10 2015

1.0.1

1.0.1.0 https://github.com/ToxicLemurs/DomainHelper

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

  Sources   Download

MIT

The Requires

 

laravel https domain php helper http simple secure facade protocol

05/10 2015

1.0.0

1.0.0.0 https://github.com/ToxicLemurs/DomainHelper

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

  Sources   Download

MIT

The Requires

 

laravel https domain php helper http simple secure facade protocol

05/10 2015

0.0.1

0.0.1.0 https://github.com/ToxicLemurs/DomainHelper

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

  Sources   Download

MIT

The Requires

 

laravel https domain php helper http simple secure facade protocol