Skip to content

Configuration file

Viames Marino edited this page Mar 13, 2025 · 5 revisions

Pair framework: .env configuration file

The configuration file is named .env and contains customizable parameters required by Pair. In case of subsequent changes after the installation, you can edit it manually.

# Product
PRODUCT_VERSION = 1.0
PRODUCT_NAME = Your application name
UTC_DATE = TRUE

# Database
DB_HOST = your_host
DB_NAME = your_name
DB_USER = your_user
DB_PASS = your_pass
DB_UTF8 = TRUE

# Date in locale format
PAIR_FORM_DATE_FORMAT = d-m-Y
PAIR_FORM_DATETIME_FORMAT = d-m-Y H:i

# Options
PAIR_ENVIRONMENT = production
PAIR_AUDIT_PASSWORD_CHANGED = TRUE
PAIR_AUDIT_LOGIN_FAILED = TRUE
PAIR_AUDIT_LOGIN_SUCCESSFUL = TRUE
PAIR_AUDIT_LOGOUT = TRUE
PAIR_AUDIT_SESSION_EXPIRED = TRUE
PAIR_AUDIT_REMEMBER_ME_LOGIN = TRUE
PAIR_AUDIT_USER_CREATED = TRUE
PAIR_AUDIT_USER_DELETED = TRUE
PAIR_AUDIT_USER_CHANGED = TRUE
PAIR_AUDIT_PERMISSIONS_CHANGED = TRUE
PAIR_SINGLE_SESSION = TRUE
PAIR_AUTH_BY_EMAIL = TRUE

# Crypt keys
OPTIONS_CRYPT_KEY = e94g83948g3h345230g3hj4in34Liwu349UB924iuregnIJbweki239
AES_CRYPT_KEY = AUNE834btg34ung324oi3n5rhg35h239324ng35okn456hj843ybt62

By creating different versions of the .env file you can install your web project on different web servers for different purposes. This is useful, for example, to run a development version, a staging version, and a production version.

Optional parameters

DB_UTF8

The definition of this constant may be necessary if there are restrictions in the MySQL configuration panel that do not allow all UTF-8 variables to be set as required. This forces all the character_set_* and collation_* configuration parameters of MySQL to the latest standards that support the extensive charset introduced by smartphones and tablets virtual keyboards. This also solves the problem of storing emoji chars in database fields.

DB_UTF8 = TRUE

This value is added by the installer automatically in case the database does not have the correct configuration to accommodate Pair.

UTC_DATE

The definition of the value UTC_DATE can be omitted from the configuration. By default, the Pair framework converts dates to UTC TimeZone and stores them through the ActiveRecord child classes in accordance with the UTC TimeZone. Pair uses the PHP DateTime class to handle all dates and automatically executes their conversion when they are displayed to the user based on their TimeZone.

UTC_DATE = FALSE

Change this line if your application should store date according to your Time Zone instead of UTC. This may be easier in the case of applications used only by users who live in the same Time Zone.

Default timezone

If you are using Pair without forcing the UTC timezone (UTC_DATE = FALSE or undefined) and the default timezone was not specified in the php.ini you will get a configuration error. You can avoid the error by adding the following optional code line to the index.php file:

date_default_timezone_set('Europe/Rome');

You can customize the default timezone for your project by picking an entry from this list.

Clone this wiki locally