Configuration

All project settings are stored in a single file config.json, located in the root directory of the site. At startup, the platform reads it and defines each parameter as a PHP constant. This means that in any project script you can access configuration parameters directly by name, for example MELBIS_LANG or MELBIS_CACHE.

The config.json file is protected from direct browser access by an .htaccess rule.

The file can be edited manually, however we recommend using the built-in dialog in the Melbis Shop application: menu “Design → Installation”. It provides a convenient graphical interface for all configuration parameters and allows you to test the database connection immediately.

When creating a storefront on the Melbis platform, the first thing you need to do is include the units/melbis.php file — this is where config.json is loaded and the platform is initialized. This is described in more detail in the “Root Scripts” section.

Example configuration file:

{
    "MELBIS_DB_HOST_NAME": "localhost",
    "MELBIS_DB_USER_NAME": "shop_user",
    "MELBIS_DB_USER_PASS": "password",
    "MELBIS_DB_NAME":      "shop_db",
    "MELBIS_DB_NICK":      "ms",
    "MELBIS_DB_CHARSET":   "utf8mb4",
    "MELBIS_DB_COMMAND":   "SET sql_mode = CONCAT(@@sql_mode, ',NO_UNSIGNED_SUBTRACTION');",
    "MELBIS_DB_ENGINE":      "MyISAM",
    "MELBIS_DB_ENGINE_TEMP": "Memory",
    "MELBIS_TIME_ZONE":    "Europe/Kyiv",
    "MELBIS_LANG":         "ru",
    "MELBIS_CHARSET":      "UTF-8",
    "MELBIS_DESKTOP_CHARSET": "WIN1251",
    "MELBIS_CACHE":        true,
    "MELBIS_TEMPLATE":     "default",
    "MELBIS_ROOT":         "/",
    "MELBIS_BUILD":        "1",
    "MELBIS_DEBUG_CODE":   "",
    "MELBIS_USER_LOG":     false,
    "MELBIS_IP_LIST":      "",
    "MELBIS_BACKUP_TIME_BEGIN": "05:00:00",
    "MELBIS_BACKUP_TIME_END":   "05:30:00"
}

Database Parameters

Parameter Description
MELBIS_DB_HOST_NAME MySQL server host. Can include a port separated by a colon, for example localhost:3311.
MELBIS_DB_USER_NAME Database username.
MELBIS_DB_USER_PASS Database user password.
MELBIS_DB_NAME Database name.
MELBIS_DB_NICK Table alias (prefix). Used in SQL queries as {DBNICK}. For example, with the value ms, the table {DBNICK}_topic becomes ms_topic. This allows multiple projects to be stored in a single database without table name conflicts.
MELBIS_DB_CHARSET Database connection encoding. utf8mb4 is recommended.
MELBIS_DB_COMMAND SQL command executed immediately after connecting to the database. Typically used to configure the MySQL operating mode.
MELBIS_DB_ENGINE Default table engine. MyISAM is recommended — it ensures efficient operation of the platform’s table cache.
MELBIS_DB_ENGINE_TEMP Engine for temporary tables. Memory is recommended for maximum speed.

Localization Parameters

Parameter Description
MELBIS_TIME_ZONE Server time zone. Used in all date and time operations. The value must conform to PHP format, for example Europe/Kyiv, UTC.
MELBIS_LANG Default interface language, for example ru, en, uk.
MELBIS_CHARSET Site page encoding. UTF-8 is recommended.
MELBIS_DESKTOP_CHARSET Encoding for data exchange with the Melbis Shop Windows client. Typically WIN1251.

Platform Parameters

Parameter Description
MELBIS_CACHE Enables (true) or disables (false) the caching system. During development it is convenient to temporarily disable it to see changes without clearing the cache.
MELBIS_TEMPLATE The name of the active template set. Default is default. Corresponds to the name of a subdirectory inside templates/.
MELBIS_ROOT Path to the site relative to the domain root. If the site is at the root — /. If in a subdirectory, for example www.site.com/shop/ — specify /shop/. The value is used to generate correct links.
MELBIS_BUILD Current build number. Appended to the URLs of CSS and JavaScript files as a cache-busting parameter (?v=1). Increment the value when deploying a new frontend version so that browsers reload the files.

Debugging and Logging Parameters

Parameter Description
MELBIS_DEBUG_CODE Secret key for enabling debug mode. To activate the debugger, add the parameter ?debug_on_KEY to the URL, where KEY is the value of this parameter. If the value is empty, the debugger is disabled.
MELBIS_USER_LOG Enables (true) user activity logging.
MELBIS_IP_LIST Comma-separated list of IP addresses. If set, access to the site will only be allowed from these addresses. Useful for restricting access during development.

Backup Parameters

Parameter Description
MELBIS_BACKUP_TIME_BEGIN Start time of the backup window in HH:MM:SS format.
MELBIS_BACKUP_TIME_END End time of the backup window in HH:MM:SS format.

During the specified time window, the platform may perform scheduled data backup operations.

Custom Constants

In addition to system configuration parameters, the platform supports custom project constants — arbitrary key-value pairs stored in the database table {DBNICK}_self_key_value. This is a convenient mechanism for storing settings specific to a particular project: API keys, working hours, limits, feature toggles, and any other data.

The most convenient way to manage these constants is through the Melbis Shop application: menu “Design → Settings Registry”, tab “Custom Settings”. The interface allows you to define a complex yet clear structure — for each constant you specify a key name, prefix, label, value, and description. In addition, access permissions are configured here: you can allow editing of specific constants through the application only to certain user groups.

Two methods exist for loading custom constants into PHP code:

DefineSelfConst() — loads all records from the {DBNICK}_self_key_value table as PHP constants, available in any module:

MELBIS()->DefineSelfConst();

// After this, the following can be used in code:
// KASDIM_WORK_TIME_BEGIN  -> '08:00'
// KASDIM_WORK_HOLIDAY     -> 'Sat/Sun'

DefineSelfVars($prefix) — loads only records with the specified prefix and places them into the global gVars array, making them available in HTML templates:

MELBIS()->DefineSelfVars('CONST');

// The following becomes available in the template:
// {CONST:SOME_KEY}

Thus, DefineSelfConst operates within the PHP constants namespace and covers all records, while DefineSelfVars provides selective loading by prefix into the template engine context.