Menu

## Config
in package

Config.php : 19

Configuration class for loading and managing config settings.

This class is responsible for loading and managing configuration settings.

##### Tags

see
  https://www.kotchasan.com/

### Table of Contents

$cache_expire : int
  Cache expiration time in seconds.
$char_set : string
  Default character set.
$email_charset : string
  The character set for outgoing emails, e.g., tis-620.
$email_Host : string
  The mail server hostname, e.g., localhost or smtp.gmail.com.
$email_Password : string
  The password for the mail server.
$email_Port : int
  The mail server port number (default is 25, use 465 or 587 for Gmail, 587 for DirectAdmin).
$email_SMTPAuth : bool
  Specifies whether SMTP authentication is required for the mail server.
$email_SMTPSecure : string
  The SSL encryption protocol for sending emails, e.g., ssl.
$email_use_phpMailer : int
  Selects the program used for sending emails (1 for PHPMailer).
$email_Username : string
  The username for the mail server.
$languages : array<string|int, mixed>
  The list of supported languages (found in the language/ directory). The default language is 'en' (English).
$login_fields : array<string|int, mixed>
  The list of fields from the member table used for login.
$noreply_email : string
  The email address used as the sender for non-reply emails, e.g., no-reply@domain.tld.
$password_key : string
  The encryption key for password encryption.
$skin : string
  The currently used template (folder name).
$timezone : string
  The server timezone, e.g., Asia/Bangkok (use Asia/Bangkok for servers located in Thailand).
$web_description : string
  The description of the website.
$web_title : string
  The title of the website.
$instance : Singleton
create() : static
  Creates an instance of the class, which can be called only once.
get() : mixed
  Retrieves the value of a variable and converts the result based on the specified data type in $default.
load() : object
  Loads the config file.
save() : bool
  Saves the project's config file.
__construct() : static
  Creates an instance of the class, which can be called only once.

### Properties

#### $cache_expire

Config.php : 28

Cache expiration time in seconds.

`public int $cache_expire = 0`

0 means no caching.

#### $char_set

Config.php : 35

Default character set.

`public string $char_set = 'UTF-8'`

#### $email_charset

Config.php : 85

The character set for outgoing emails, e.g., tis-620.

`public string $email_charset = 'utf-8'`

#### $email_Host

Config.php : 42

The mail server hostname, e.g., localhost or smtp.gmail.com.

`public string $email_Host = 'localhost'`

#### $email_Password

Config.php : 49

The password for the mail server.

`public string $email_Password = ''`

#### $email_Port

Config.php : 56

The mail server port number (default is 25, use 465 or 587 for Gmail, 587 for DirectAdmin).

`public int $email_Port = 25`

#### $email_SMTPAuth

Config.php : 64

Specifies whether SMTP authentication is required for the mail server.

`public bool $email_SMTPAuth = false`

If set to true, username and password for the mail server must be provided.

#### $email_SMTPSecure

Config.php : 71

The SSL encryption protocol for sending emails, e.g., ssl.

`public string $email_SMTPSecure = ''`

#### $email_use_phpMailer

Config.php : 92

Selects the program used for sending emails (1 for PHPMailer).

`public int $email_use_phpMailer = 1`

#### $email_Username

Config.php : 78

The username for the mail server.

`public string $email_Username = ''`

#### $languages

Config.php : 99

The list of supported languages (found in the language/ directory). The default language is 'en' (English).

`public array<string|int, mixed> $languages = ['th']`

#### $login_fields

Config.php : 106

The list of fields from the member table used for login.

`public array<string|int, mixed> $login_fields = ['username']`

#### $noreply_email

Config.php : 113

The email address used as the sender for non-reply emails, e.g., no-reply@domain.tld.

`public string $noreply_email = ''`

#### $password_key

Config.php : 120

The encryption key for password encryption.

`public string $password_key = '1234567890'`

#### $skin

Config.php : 127

The currently used template (folder name).

`public string $skin = 'default'`

#### $timezone

Config.php : 134

The server timezone, e.g., Asia/Bangkok (use Asia/Bangkok for servers located in Thailand).

`public string $timezone = 'Asia/Bangkok'`

#### $web_description

Config.php : 141

The description of the website.

`public string $web_description = 'PHP Framework developed by Thai people'`

#### $web_title

Config.php : 148

The title of the website.

`public string $web_title = 'Kotchasan PHP Framework'`

#### $instance

Config.php : 152
`private static Singleton $instance = null`

used to invoke this class only once

### Methods

#### create()

Config.php : 159

Creates an instance of the class, which can be called only once.

`public static create() : static`

##### Return values

static —

#### get()

Config.php : 175

Retrieves the value of a variable and converts the result based on the specified data type in $default.

`public get(string $key[, mixed $default = '' ]) : mixed`

##### Parameters

$key : string

  Variable name

$default : mixed = ''

  (optional) Default value if the variable is not found

##### Return values

mixed —

#### load()

Config.php : 202

Loads the config file.

`public static load(string $file) : object`

##### Parameters

$file : string

  Config file (fullpath)

##### Return values

object —

#### save()

Config.php : 219

Saves the project's config file.

`public static save(array<string|int, mixed> $config, string $file) : bool`

##### Parameters

$config : array<string|int, mixed>
$file : string

  Config file (fullpath)

##### Return values

bool —

#### __construct()

Config.php : 247

Creates an instance of the class, which can be called only once.

`protected __construct() : static`

##### Return values

static —

## Search results