Environment variables


Webasyst framework offers several service functions to developers, which facilitate access to environment variables (arrays $_GET, $_POST, $_COOKIE, and $_SERVER). All functions used for the processing environment variables are accessible as the methods of static system class waRequest.

Method waRequest::getMethod() returns the type of the received HTTP request (GET or POST).

Environment variable reading methods:

waRequest::get($name, $default, $type)
waRequest::post($name, $default, $type)
waRequest::cookie($name, $default, $type)
waRequest::server($name, $default, $type)

In addition to the methods used for accessing standard environment variables, class waRequest also offers a similar method to access parameters received from the frontend request routing system (i.e. request parameters contained in SEO-friendly URLs):

waRequest::param($name, $default, $type)

All these methods have a common calling signature with three optional arguments $name, $default, $type:

Supported data types for variables: