FrostMVC\Site
use FrostMVC\Site;
Application configuration and bootstrap context.
Holds site-level settings (name, URL, email, environment), initialises the Twig view layer, and manages multiple named site instances for multi-site setups. The active instance is stored in Site::$instance and is accessible globally via the framework's getInstance() helper.
| Property | Type | Description |
|---|---|---|
| $NAMESPACE | mixed |
|
| $APPPATH | mixed |
|
| $BASEPATH | mixed |
|
| $RESOURCEPATH | mixed |
|
| $from | mixed |
|
| $extra | mixed |
|
| Site::$instance | mixed |
|
| Site::$instances | mixed |
|
| $twig | mixed |
|
| $require | mixed |
|
| $loader | mixed |
| ->__construct() | — |
| ::addInstance() | Creates or updates a named Site instance from a configuration array. Accepts keys: name, url, contact, email, address, mobile, facebook, FBID, twitter, namespace, environment, timezone, libraries[], twig{}. |
| ->getAddress() | — |
| ::getClientIP() | Returns the client IP address, walking common proxy headers in priority order. Note: HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR can be spoofed by clients. Validate the result against a trusted-proxy allowlist for security-sensitive use cases. |
| ->getContact() | — |
| ::getCurrentURL() | Returns the full current request URL (protocol + host + path + query string). When $fullPath is false, only the protocol and host are returned. |
| ->getEmail() | — |
| ->getEnvironment() | Returns the current environment string, e.g. 'Development' or 'Production'. Twig debug mode is enabled when this equals 'Development'. |
| ->getFacebook() | — |
| ->getFBID() | — |
| ->getHomeSite() | — |
| ::getInstance() | Returns the named Site instance, creating it if necessary. |
| ->getMobile() | — |
| ->getMultiSiteMode() | — |
| ->getName() | — |
| ->getNamespace() | — |
| ::getProtocol() | Detects the current request protocol (http or https). Respects Cloudflare's CF-Visitor header and reverse-proxy X-Forwarded-Proto. |
| ::getQueryParams() | Parses query parameters and path segments from a URL. |
| ->getTwitter() | — |
| ->getURL() | — |
| ->getVersion() | — |
| ->setAddress() | — |
| ->setContact() | — |
| ->setEmail() | — |
| ->setEnvironment() | — |
| ->setFacebook() | — |
| ->setFBID() | — |
| ->setHomeSite() | — |
| ->setMobile() | — |
| ->setMultiSiteMode() | — |
| ->setName() | — |
| ->setNamespace() | — |
| ->setTwitter() | — |
| ->setURL() | — |
| ->setVersion() | — |
$site->__construct($siteName = '')
No description yet.
| $siteName | string |
Optional name for this site instance. Default:'' |
Site::addInstance($config): FrostMVC\Site
Creates or updates a named Site instance from a configuration array. Accepts keys: name, url, contact, email, address, mobile, facebook, FBID, twitter, namespace, environment, timezone, libraries[], twig{}.
| $config | array |
Associative configuration array. |
Site
$site->getAddress()
No description yet.
string Physical address.
Site::getClientIP()
Returns the client IP address, walking common proxy headers in priority order. Note: HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR can be spoofed by clients. Validate the result against a trusted-proxy allowlist for security-sensitive use cases.
string IP address string, or 'UNKNOWN' when no header is present.
$site->getContact()
No description yet.
string Primary contact number.
Site::getCurrentURL($fullPath = true)
Returns the full current request URL (protocol + host + path + query string). When $fullPath is false, only the protocol and host are returned.
| $fullPath | bool |
When true (default), includes the request URI. Default:true |
string
$site->getEmail()
No description yet.
string Contact email address.
$site->getEnvironment()
Returns the current environment string, e.g. 'Development' or 'Production'. Twig debug mode is enabled when this equals 'Development'.
string
$site->getFacebook()
No description yet.
string Facebook page URL or slug.
$site->getFBID()
No description yet.
string Facebook App ID.
$site->getHomeSite()
No description yet.
string Root/homepage URL used for cross-site redirects.
Site::getInstance($siteName): FrostMVC\Site
Returns the named Site instance, creating it if necessary.
| $siteName | string |
The site instance name. |
Site
$site->getMobile()
No description yet.
string Mobile number.
$site->getMultiSiteMode()
No description yet.
string Multi-site routing mode: 'subfolder' or 'subdomain'.
$site->getName()
No description yet.
string Site display name.
$site->getNamespace()
No description yet.
string
Site::getProtocol()
Detects the current request protocol (http or https). Respects Cloudflare's CF-Visitor header and reverse-proxy X-Forwarded-Proto.
string 'http' or 'https'.
Site::getQueryParams($url, $parameter = false, $defaultValue = false)
Parses query parameters and path segments from a URL.
| $url | string|true |
The URL to parse, or true for the current request URL. |
| $parameter | string|true|false |
Query parameter name, true for path segments, or false to populate $_GET. Default:false |
| $defaultValue | mixed |
Returned when a named $parameter is not present in the URL. Default:false |
mixed
$site->getTwitter()
No description yet.
string Twitter handle.
$site->getURL()
No description yet.
string Canonical base URL of this site (no trailing slash).
$site->getVersion()
No description yet.
string Plugin/app version (e.g. '1.0.0').
$site->setAddress($newval)
No description yet.
| $newval | string |
$site->setContact($newval)
No description yet.
| $newval | string |
$site->setEmail($newval)
No description yet.
| $newval | string |
$site->setEnvironment($newval)
No description yet.
| $newval | string |
Environment name. Ignored when $newval is true. |
$site->setFacebook($newval)
No description yet.
| $newval | string |
Facebook page URL or slug. |
$site->setFBID($newval)
No description yet.
| $newval | string |
Facebook App ID. |
$site->setHomeSite($newval)
No description yet.
| $newval | string |
$site->setMobile($newval)
No description yet.
| $newval | string |
$site->setMultiSiteMode($newval)
No description yet.
| $newval | string |
Multi-site routing mode: 'subfolder' or 'subdomain'. |
$site->setName($newSiteName)
No description yet.
| $newSiteName | string |
$site->setNamespace($namespace)
No description yet.
| $namespace | string |
PHP namespace prefix used when autoloading application classes. |
$site->setTwitter($newval)
No description yet.
| $newval | string |
Twitter handle. |
$site->setURL($newval)
No description yet.
| $newval | string |
Canonical base URL. |
$site->setVersion($newval)
No description yet.
| $newval | string |
Plugin/app version. |
Generated from core/classes/Site.php (FrostMVC ).