Config
in package
Configuration class for loading and managing config settings.
This class is responsible for loading and managing configuration settings.
Tags
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
Cache expiration time in seconds.
public
int
$cache_expire
= 0
0 means no caching.
$char_set
Default character set.
public
string
$char_set
= 'UTF-8'
$email_charset
The character set for outgoing emails, e.g., tis-620.
public
string
$email_charset
= 'utf-8'
$email_Host
The mail server hostname, e.g., localhost or smtp.gmail.com.
public
string
$email_Host
= 'localhost'
$email_Password
The password for the mail server.
public
string
$email_Password
= ''
$email_Port
The mail server port number (default is 25, use 465 or 587 for Gmail, 587 for DirectAdmin).
public
int
$email_Port
= 25
$email_SMTPAuth
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
The SSL encryption protocol for sending emails, e.g., ssl.
public
string
$email_SMTPSecure
= ''
$email_use_phpMailer
Selects the program used for sending emails (1 for PHPMailer).
public
int
$email_use_phpMailer
= 1
$email_Username
The username for the mail server.
public
string
$email_Username
= ''
$languages
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
The list of fields from the member table used for login.
public
array<string|int, mixed>
$login_fields
= ['username']
$noreply_email
The email address used as the sender for non-reply emails, e.g., no-reply@domain.tld.
public
string
$noreply_email
= ''
$password_key
The encryption key for password encryption.
public
string
$password_key
= '1234567890'
$skin
The currently used template (folder name).
public
string
$skin
= 'default'
$timezone
The server timezone, e.g., Asia/Bangkok (use Asia/Bangkok for servers located in Thailand).
public
string
$timezone
= 'Asia/Bangkok'
$web_description
The description of the website.
public
string
$web_description
= 'PHP Framework developed by Thai people'
$web_title
The title of the website.
public
string
$web_title
= 'Kotchasan PHP Framework'
$instance
private
static Singleton
$instance
= null
used to invoke this class only once
Methods
create()
Creates an instance of the class, which can be called only once.
public
static create() : static
Return values
static —get()
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()
Loads the config file.
public
static load(string $file) : object
Parameters
- $file : string
-
Config file (fullpath)
Return values
object —save()
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()
Creates an instance of the class, which can be called only once.
protected
__construct() : static