AppConf
in package
Read onlyYes
FinalYes
Creates and validates a configuration given the path to the project folder.
It creates a configuration file that merges the distributed configuration file, lmwf_app.json, with the local file, .lmwf_app.local.json. If the two define the same key, the latter overrides the former. Note that the entire value for the key is overriden, even if the value is a dictionnary.
Tags
Table of Contents
Constants
- APP_PATH_KEY : string = "appPath"
- DIST_FN : string = "lmwf_app.json"
- HANLDE_EXCEPTIONS : string = "handleExceptions"
- LANGUAGE_KEY : string = "language"
- LOCAL_FN : string = ".lmwf_app.local.json"
Properties
- $appRootPath : string
- $baseUrl : string
- $data : AppObject<string|int, mixed>
- Gives access to the raw configuration data.
- $handleExceptions : bool
- $httpConf : HttpConf
- $isDev : bool
- $language : string
- $publicRelPath : string
- $thumbnailFormats : array<string, ImgFormat>
- $uploadRelPath : string
Methods
- __construct() : mixed
- The path is the absolute path on the server file system. The relative path is the path on the file system relative to the app root.
- createFromEnvFile() : self
- The dist file must exists. The local file might not exist, but if it exists it must be readable and valid.
- getBoolSetting() : bool
- getNullableSetting() : string|null
- getPathOfUploadedFiles() : string
- getSetting() : string
- hasSetting() : bool
- readCsps() : array<string, array<int, string>>
- readErrorControllerFqcn() : IController>
Constants
APP_PATH_KEY
public
string
APP_PATH_KEY
= "appPath"
DIST_FN
public
string
DIST_FN
= "lmwf_app.json"
HANLDE_EXCEPTIONS
public
string
HANLDE_EXCEPTIONS
= "handleExceptions"
LANGUAGE_KEY
public
string
LANGUAGE_KEY
= "language"
LOCAL_FN
public
string
LOCAL_FN
= ".lmwf_app.local.json"
Properties
$appRootPath
public
string
$appRootPath
$baseUrl
public
string
$baseUrl
$data
Gives access to the raw configuration data.
public
AppObject<string|int, mixed>
$data
Stored as AppObject to ensure it cannot be mutated.
$handleExceptions
public
bool
$handleExceptions
$httpConf
public
HttpConf
$httpConf
$isDev
public
bool
$isDev
$language
public
string
$language
$publicRelPath
public
string
$publicRelPath
$thumbnailFormats
public
array<string, ImgFormat>
$thumbnailFormats
$uploadRelPath
public
string
$uploadRelPath
Methods
__construct()
The path is the absolute path on the server file system. The relative path is the path on the file system relative to the app root.
public
__construct(AppObject<string|int, mixed> $confParams) : mixed
Parameters
- $confParams : AppObject<string|int, mixed>
Tags
createFromEnvFile()
The dist file must exists. The local file might not exist, but if it exists it must be readable and valid.
public
static createFromEnvFile(string $confFolderPath[, array<string, mixed> $confData = [] ]) : self
Parameters
- $confFolderPath : string
- $confData : array<string, mixed> = []
Tags
Return values
selfgetBoolSetting()
public
getBoolSetting(string $key) : bool
Parameters
- $key : string
Return values
boolgetNullableSetting()
public
getNullableSetting(string $key) : string|null
Parameters
- $key : string
Return values
string|nullgetPathOfUploadedFiles()
public
getPathOfUploadedFiles() : string
Return values
stringgetSetting()
public
getSetting(array<string|int, mixed>|string $key) : string
Parameters
- $key : array<string|int, mixed>|string
Return values
stringhasSetting()
public
hasSetting(string $key) : bool
Parameters
- $key : string
Return values
boolreadCsps()
private
readCsps(AppObject<string|int, mixed> $confParams) : array<string, array<int, string>>
Parameters
- $confParams : AppObject<string|int, mixed>
Return values
array<string, array<int, string>>readErrorControllerFqcn()
private
readErrorControllerFqcn(AppObject<string|int, mixed> $confParams, string $error) : IController>
Parameters
- $confParams : AppObject<string|int, mixed>
- $error : string