Skip to content

Internals Awt_src Functions Awt_getDomain

Stefan Crkvenjakov edited this page Oct 7, 2026 · 1 revision

awt_src/functions/awt_getDomain.fun.php

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/functions/awt_getDomain.fun.php · Snapshot 8411f4287706.

Global helpers register autoloading and exception handlers or construct the application base URL from the request and settings.

Imports and dependencies

use setting\Config;

getDomainName

function getDomainName(): ?string

Return expressions (including local callbacks): $scheme . "://" . $host . Config::getConfig("AWT", "hostname path")->getValue().

Function implementation
function getDomainName(): ?string
{
    $scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';

    $host = $_SERVER['HTTP_HOST'];
    return $scheme . "://" . $host . Config::getConfig("AWT", "hostname path")->getValue();

}

Execution and global state

The script below is executed by its caller. Constants, registered callbacks, global assignments, guards, included files and their order are preserved here. Unlike class methods, entry-point execution can start the CLI loop, route a request, emit output, or terminate the process.

<?php

use setting\Config;

/**
 * Function getDomainName
 * @return string|null Returns a base domain name without requested URI.
 */
function getDomainName(): ?string
{
    $scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';

    $host = $_SERVER['HTTP_HOST'];
    return $scheme . "://" . $host . Config::getConfig("AWT", "hostname path")->getValue();

}

Related types

Clone this wiki locally