Documentation/Installation and configuration/3. Configuration

Configuration Setup

The settings for the HLEB2 framework are stored in configuration files within the /config/ folder.
At the beginning of some of these files, you might find a line similar to this:

if (file_exists(__DIR__ '/common-local.php')) { return (require __DIR__ '/common-local.php');}

This code indicates that if the file common-local.php exists in this folder, its settings will be used instead of the current ones (from the common.php file).

Therefore, you can create copies of these files with the addition of '-local' to their names and use them for local development without adding them to version control (i.e., without pushing them to the target server). In these copied files, make sure to remove this line of code, as it is no longer necessary.

Separate configurations for local development and the final server provide convenience for setup.

The framework allows retrieval of any configuration value by its name, so these settings can also be used for initializing third-party libraries.


#Debug Mode

In DEBUG mode, the framework operates slightly differently than usual, displaying debugging information and errors that should not be accessible on a public resource.

The framework's debug mode should only be used for internal development.

To disable/enable debug mode, change the debug value in the /config/common.php file as needed.

Similarly, other configuration settings can be modified.


#Caching

In debug mode, it is also helpful to disable caching performed by the framework. The setting app.cache.on in the /config/common.php file controls this.


#Automatic Route Cache Update

The framework has built-in automatic route cache updates by default when developers make changes to them.
This feature is convenient for local development, but as request volume increases, you might disable auto-updating on a production server and use a special console command whenever changes are made. The auto-update mode is adjusted by the routes.auto-update parameter in the /config/common.php file.


#Logging Errors

By default, information about errors is saved in the files located in the /storage/logs/ folder. If DEBUG mode is enabled, errors may also be displayed to the user (in the browser or via API).
The error level can be configured in the error.reporting setting of the /config/common.php file. Initially, all levels of PHP errors are reported (recommended setting).


#Timezone

The timezone setting in the /config/common.php file specifies the timezone for date/time functions.
Default: 'Europe/Moscow'.


#Database Settings

The /config/database.php file contains settings for the databases in use. Initially, it provides several different examples.
Within the configuration file, the list of configurations is a nested array with the key 'db.settings.list', from which the default settings block is selected, indicated by the 'base.db.type' option.

Setting up the framework Project Structure

Page translated: chatgpt 4-o
Back to top