Raydium Framework

Domain
in package

Table of Contents

$baseDomain  : string
$targetSubdomain  : string
__construct()  : mixed
Constructor.
detectTargetSubdomain()  : bool
Detect if the target subdomain exists in the subdomain from a PSR-7 ServerRequest.
getFullSubdomain()  : null|string
Get the full subdomain from a given host, handling nested subdomains.
hasTargetSubdomain()  : bool
Detect if the target subdomain exists in the subdomain.
strEndsWith()  : bool
Polyfill for str_ends_with for PHP 7.4, using native function if available.

Properties

$baseDomain

protected string $baseDomain

$targetSubdomain

protected string $targetSubdomain

Methods

__construct()

Constructor.

public __construct(string $baseDomain, string $targetSubdomain) : mixed
Parameters
$baseDomain : string

The base domain (e.g., "example.com").

$targetSubdomain : string

The subdomain to detect (e.g., "admin").

Return values
mixed

detectTargetSubdomain()

Detect if the target subdomain exists in the subdomain from a PSR-7 ServerRequest.

public detectTargetSubdomain(ServerRequestInterface $request) : bool
Parameters
$request : ServerRequestInterface

The PSR-7 request.

Return values
bool

True if the target subdomain is present, false otherwise.

getFullSubdomain()

Get the full subdomain from a given host, handling nested subdomains.

public getFullSubdomain(string $host) : null|string
Parameters
$host : string

The host name (e.g., "admin.staging.example.com").

Return values
null|string

The full subdomain (e.g., "admin.staging"), or null if no subdomain exists.

hasTargetSubdomain()

Detect if the target subdomain exists in the subdomain.

public hasTargetSubdomain(string $host) : bool
Parameters
$host : string

The host name (e.g., "admin.staging.example.com").

Return values
bool

True if the target subdomain is present, false otherwise.

strEndsWith()

Polyfill for str_ends_with for PHP 7.4, using native function if available.

private strEndsWith(string $haystack, string $needle) : bool
Parameters
$haystack : string

The string to check.

$needle : string

The substring to search for.

Return values
bool

True if $haystack ends with $needle, false otherwise.

Search results