View on GitHub

Environment Variables

Introduction

The framework have global constants which acts as environment variables and are used to configure some of the settings. They can be accessed anywhere within the scope of the application. Developer can modify the values of variables in application configuration.

Variables

The following table lists all environment variables and for what each one is used.

Variable Name Description Default Value
WF_VERSION Version number of the framework. The format of the version is x.x.x . ( string )
WF_VERSION_TYPE Framework version type such as 'beta', 'alpha', 'cr' or 'stable'. ( string )
WF_RELEASE_DATE The date at which this version of the framework was released on. The format of the date is 'YYYY-MM-DD'. ( string )
APP_DIR The name of the directory at which application source code will live in. Default value is app . Developer can override the value if the constant inside the file public/index.php ( string )
ROOT_PATH The path to root directory of source code. The value of this constant is usually the name of the directory at which framework and application files exist in. ( string )
USE_HTTP Sets the framework to use http:// or https:// for base URIs. The default behaviour of the framework is to use https:// . But in some cases, there is a need for using http:// . If this constant is set to true, the framework will use http:// for base URI of the system. Default value is false. false ( boolean )
SCRIPT_MEMORY_LIMIT Memory limit per script. This constant represents the maximum amount of memory each script will consume before showing a fatal error. The developer can change this value as needed. '2GB' ( string )
LOAD_COMPOSER_PACKAGES This constant is used to tell the core if the application uses composer packages or not. If set to true, then composer packages will be loaded. true ( boolean )
CRON_THROUGH_HTTP A constant which is used to enable or disable HTTP access to cron. If the constant value is set to true, the framework will add routes to the components which is used to allow access to cron control panel. The control panel is used to execute jobs and check execution status. false boolean
NO_WWW This constant is used to redirect a URI with www to non-www . If this constant is defined and is set to true and a user tried to access a resource using a URI that contains www in the host part, the router will send a 301 - permanent redirect HTTP response code and send the user to non-www host. For example, if a request is sent to https://www.example.com/my-page , it will be redirected to https://example.com/my-page . false ( boolean )
DATE_TIMEZONE Define the timezone at which the system will operate in. The value of this constant is passed to the function date_default_timezone_set() . This one is used to fix some date and time related issues when the application is deployed in multiple servers. See http://php.net/manual/en/timezones.php for supported time zones. Change this as needed. 'Asia/Riyadh' ( string )
PHP_INT_MIN Fallback for older php versions that does not support the constant PHP_INT_MIN . ( double )
WF_VERBOSE This constant is used to tell the framework if more information should be displayed if an exception is thrown or an error happens. The main aim of this constant is to hide some sensitive information from users if the system is in production environment. Note that the constant will have effect only if the framework is accessed through HTTP protocol. If used in CLI environment, everything will appear. false ( boolean )
WF_SESSION_STORAGE A constant which holds the class name of sessions storage engine alongside its namespace.The value of this constant is used to configure session storage engine. For example, if the name of the class that represents storage engine is MySessionStorage and the class exist in the namespace extras\util , then the value of the constant should be \extras\util\MySessionStorage . "\webfiori\framework\session\DefaultSessionStorage" ( string )
THEMES_PATH This constant represents the directory at which themes exist. 'themes' ( string )
CLI_HTTP_HOST Host name to use in case the system is executed through CLI. When the application is running through CLI, there is no actual host name. For this reason, the host is set to 127.0.0.1 by default. If this constant is defined, the host will be changed to the value of the constant. Default value of the constant is 'example.com'. 'example.com' ( string )
DS Directory separator. This one is is used as a shorthand instead of using PHP constant DIRECTORY_SEPARATOR . The two will have the same value. ( string )
WF_PATH_TO_REMOVE An optional string which represents the path part of a URI. The part which is defined by this constant will be removed when constructing the path part of the base URL of web pages. This is useful for the cases where the application exist inside a folder which exist inside the document root of the server. Not defined( string )
WF_PATH_TO_APPEND An optional string which represents the path part of a URI. The part which is defined by this constant will be appended when constructing the path part of the base URL of web pages. This is useful for the cases where the application exist inside a folder which exist inside the document root of the server. Not Defined( string )
JSON_PROP_STYLE This constant is used to specify the global properties style which will be used by any Json instance. The constant can have one of the following values only: snake , kebab , camel and none . Not Defined( string )
SESSION_GC The value of this variable is used to determine the time at which sessions will be cleared after in seconds. Not Defined ( int )

Next: Coding Standards

Previous: Internationalization