Beamtic's logo
  1. Create user

Share via:

Class: extra_server_vars

List of extra server variables introduced by the extra_server_vars.php file.


Edited: 2020-07-22 23:43

There is a number of extra _SERVER variables introduced to solve both common and uncommon problems, these are loaded by the extra_server_vars class, inside of extra_server_vars.php, and before the superglobals.php file has been loaded.

If you are using the superglobals class outside of the CMS, then you will need to load the extra_server_vars before loading the superglobals class.

From inside an app, the variables may be accessed like this:

// Or:


This class is instantiated automatically by the CMS. When or if this class is used from outside of the main code, it may be instantiated before the superglobals class, possibly from the composition root (I.e. Index.php).

Once the class is instantiated, the extra server variables will automatically be made available; so there is no need to call extra methods after creating the extra_server_vars object. After instantiating an object from the this class, the object may be safely destroyed, as it is no longer needed.

How exactly to access them will depend on where you are accessing them from, and also, sometimes there might be multiple ways to access superglobals; just keep in mind that superglobals should never be accessed directly.

List of server variables

Below is a list of these extra variables:

base_path The base path where the CMS is located, including "/" at the end.
request_time The time of the request. Should be used everywhere where this is needed, since calling time() later might be inaccurate..
request_protocol The protocol used by the client. I.e. "https" or "http".
full_request_uri The full public URL of the request, including URL parameters.
request_path The path (public URL) of the request, without URL parameters and without the domain name.
query_string The query string part of the URL.
work_path The current public URL of the last URL segment, with the file- or document name cut off. I.e. /images/category/


  1. About Directly Accessing Superglobals
  2. extra_server_vars.php -