Documentation

Boostack Configs

General Configs

Boostack manages configurations through two files config/env/global.php and config/env/env.php.

The global.php file contains all global variables such as paths for assets (css, js, font, images, etc.), meta tags for SEO, and social network meta tags. These configurations are "global," meaning they refer to any possible "environment."

The env.php file contains all configurations of the specific "environment" (dev, staging, pre-prod, prod). This file includes the main environment configurations such as project paths, database configurations, sessions, cookies, lob, api, etc. This file is set by default within the .gitignore to allow customization by each developer and in each possible environment (dev, staging, pre-prod, prod). This file is precompiled with the default settings of Boostack through the automatic configuration process. Be careful: modify the default configuration values following the instructions in the file.

If you need to add a new configuration, simply add a new value to the $config array, for example:

$config["config-key"] = "config-value"
Choose to insert it into the global.php file if it is a global configuration shared by all developers and environments, or into the env.php file if it is a specific configuration of an environment or a specific developer.

These files are precompiled with the default settings of Boostack through the automatic configuration process.

Accessing Configuration Values

You may easily access your configuration values using the Config class from anywhere in your application.

Config::get("configuration_key")

Example: Development Mode configuration

An example of default configuration is the variable

$config['developmentMode'] = TRUE;
present in the env.php file.

With this configuration, you can set the development mode of Boostack, which allows displaying errors and exceptions on screen for all requests in your application. This simplifies application debugging during coding.

To check if the application is in development mode, you can use the Config class as follows:

if(Config::get('developmentMode')) {
    ...
}

Automatic Preload

All configurations from the env.php and global.php files are automatically loaded by the default environment initialization procedure in all controllers using the code:

Boostack\Environment::init();