App
in package
The App is a static class for some useful globally used methods and objects.
Table of Contents
Constants
- CREATE_FILE = true
- If passed to the logger() method as the second Argument, a new StreamHandler is instantiated with the same name of the channel.
- DB_PRETTY = true
Methods
- basePath() : mixed
- Returns the basePath of the public VeruA instance.
- cfg() : Settings
- Returns the global config Instance.
- dbCfg() : Settings
- Returns a Settings Object with the selected multiDB configuration adds an additional field `index` if a multiDB configuration is used from `alt`
- dbConnect() : mysqli
- Returns a mysqli connection object use as follows: ``` php use VeruA\App; // ... $dbCon = App::dbConnect(); $dbMigel = App::dbConnect('migel'); ```
- dbDisplayName() : string
- Returns the DisplayName from the alternative database configuration or the index if none is set
- isDevEnv() : bool
- Returns true if a level above BASE_PATH has a .git directory in this case we know that we are on a develop environemnt
- lang() : SimpleTranslation
- Return the SimpleTranslation Object
- logger() : Logger
- Return the Logger instance of the given channel
- version() : Version
- Returns the installed VeruA version from the .rev file as a Version Object.
Constants
CREATE_FILE
If passed to the logger() method as the second Argument, a new StreamHandler is instantiated with the same name of the channel.
public
bool
CREATE_FILE
= true
DB_PRETTY
public
mixed
DB_PRETTY
= true
Methods
basePath()
Returns the basePath of the public VeruA instance.
public
static basePath() : mixed
presumes that the BASE_PATH constant was set beforehand in init.php
cfg()
Returns the global config Instance.
public
static cfg() : Settings
presumes that the global var $cfg was instatiated in init.php
Return values
Settings —A Settings Object
dbCfg()
Returns a Settings Object with the selected multiDB configuration adds an additional field `index` if a multiDB configuration is used from `alt`
public
static dbCfg([string $index = null ]) : Settings
Parameters
- $index : string = null
-
The index of the multidb configuration to use
Return values
SettingsdbConnect()
Returns a mysqli connection object use as follows: ``` php use VeruA\App; // ... $dbCon = App::dbConnect(); $dbMigel = App::dbConnect('migel'); ```
public
static dbConnect([mixed $name = null ]) : mysqli
Parameters
- $name : mixed = null
Return values
mysqlidbDisplayName()
Returns the DisplayName from the alternative database configuration or the index if none is set
public
static dbDisplayName([string $index = null ]) : string
Parameters
- $index : string = null
-
The db index
Return values
stringisDevEnv()
Returns true if a level above BASE_PATH has a .git directory in this case we know that we are on a develop environemnt
public
static isDevEnv() : bool
Return values
boollang()
Return the SimpleTranslation Object
public
static lang() : SimpleTranslation
Return values
SimpleTranslation —A SimpleTranslation Object
logger()
Return the Logger instance of the given channel
public
static logger([string $channel = 'debug' ][, bool|string $file = false ]) : Logger
All loggers are stored inside a static array, and are instatiated only once.
Parameters
- $channel : string = 'debug'
-
The channel of the logger
- $file : bool|string = false
-
if set to boolean true a file with the $channel name .log is created if a string is given, it is used for the filename and .log is appended
Return values
Logger —a Monolog logger instance
version()
Returns the installed VeruA version from the .rev file as a Version Object.
public
static version() : Version
If the instance runs in a development environment, git describe is used to get the version string
Return values
Version —A Version Object