App
- Type
- Class
- Namespace
- craft\helpers
- Inherits
- craft\helpers\App
- Since
- 3.0.0
App helper.
View source (opens new window)
# Public Methods
Method | Description |
---|---|
assetManagerConfig() | Returns the assetManager component config for web requests. |
backtrace() | Returns the backtrace as a string (omitting the final frame where this method was called). |
cacheConfig() | Returns the cache component config. |
checkForValidIconv() | Returns whether the server has a valid version of the iconv extension installed. |
dbConfig() | Returns the db component config. |
dbMutexConfig() | Returns the mutex component config. |
editionHandle() | Returns the handle of the given Craft edition. |
editionIdByHandle() | Returns the ID of a Craft edition by its handle. |
editionName() | Returns the name of the given Craft edition. |
editions() | Returns an array of all known Craft editions’ IDs. |
env() | Returns an environment variable, checking for it in $_SERVER and calling getenv() as a fallback. |
extensionVersion() | Returns a PHP extension version, without the distribution info. |
humanizeClass() | Returns a humanized class name. |
isEphemeral() | Returns whether Craft is running on an environment with ephemeral storage. |
isNitro() | Returns whether Craft is running within Nitro (opens new window). |
isValidEdition() | Returns whether an edition is valid. |
licenseKey() | |
logConfig() | Returns the log component config. |
mailSettings() | Returns the system email settings. |
mailerConfig() | Returns the mailer component config. |
maxPowerCaptain() | Sets PHP’s memory limit to the maximum specified by the config3:phpMaxMemoryLimit (opens new window) config setting, and gives the script an unlimited amount of time to execute. |
mutexConfig() | Returns a file-based mutex component config. |
normalizeVersion() | Removes distribution info from a version |
phpConfigValueAsBool() | Retrieves a bool PHP config setting and normalizes it to an actual bool. |
phpConfigValueInBytes() | Retrieves a disk size PHP config setting and normalizes it into bytes. |
phpVersion() | Returns the PHP version, without the distribution info. |
projectConfigConfig() | Returns the projectConfig component config. |
sessionConfig() | Returns the session component config for web requests. |
testIniSet() | Tests whether ini_set() works. |
userConfig() | Returns the user component config for web requests. |
viewConfig() | Returns the view component config. |
webRequestConfig() | Returns the request component config for web requests. |
webResponseConfig() | Returns the response component config for web requests. |
# assetManagerConfig()
- Since
- 3.0.18
Returns the assetManager
component config for web requests.
View source (opens new window)
Returns
# backtrace()
- Since
- 3.0.13
Returns the backtrace as a string (omitting the final frame where this method was called).
View source (opens new window)
Arguments
$limit
(integer (opens new window)) – The max number of stack frames to be included (0 means no limit)
Returns
# cacheConfig()
- Since
- 3.0.18
Returns the cache
component config.
View source (opens new window)
Returns
# checkForValidIconv()
Returns whether the server has a valid version of the iconv extension installed.
View source (opens new window)
Returns
# dbConfig()
- Since
- 3.0.18
Returns the db
component config.
View source (opens new window)
Arguments
$dbConfig
(craft\config\DbConfig, null (opens new window)) – The database config settings
Returns
# dbMutexConfig()
- Since
- 3.5.18
Returns the mutex
component config.
View source (opens new window)
Returns
# editionHandle()
- Since
- 3.1.0
Returns the handle of the given Craft edition.
View source (opens new window)
Arguments
$edition
(integer (opens new window)) – An edition’s ID.
Returns
string (opens new window) – The edition’s name.
# editionIdByHandle()
- Since
- 3.1.0
Returns the ID of a Craft edition by its handle.
View source (opens new window)
Arguments
$handle
(string (opens new window)) – An edition’s handle
Returns
integer (opens new window) – The edition’s ID
Throws
- yii\base\InvalidArgumentException (opens new window)
if $handle is invalid
# editionName()
Returns the name of the given Craft edition.
View source (opens new window)
Arguments
$edition
(integer (opens new window)) – An edition’s ID.
Returns
string (opens new window) – The edition’s name.
# editions()
Returns an array of all known Craft editions’ IDs.
View source (opens new window)
Returns
array (opens new window) – All the known Craft editions’ IDs.
# env()
- Since
- 3.4.18
Returns an environment variable, checking for it in $_SERVER
and calling getenv()
as a fallback.
View source (opens new window)
Arguments
$name
(string (opens new window)) – The environment variable name
Returns
string (opens new window), array (opens new window), false (opens new window) – The environment variable value
# extensionVersion()
Returns a PHP extension version, without the distribution info.
View source (opens new window)
Arguments
$name
(string (opens new window)) – The extension name
Returns
# humanizeClass()
Returns a humanized class name.
View source (opens new window)
Arguments
$class
(string (opens new window))
Returns
# isEphemeral()
- Since
- 3.4.0
Returns whether Craft is running on an environment with ephemeral storage.
View source (opens new window)
Returns
# isNitro()
- Since
- 3.4.19
Returns whether Craft is running within Nitro (opens new window).
View source (opens new window)
Returns
# isValidEdition()
Returns whether an edition is valid.
View source (opens new window)
Arguments
$edition
(mixed
) – An edition’s ID (or is it?)
Returns
boolean (opens new window) – Whether $edition is a valid edition ID.
# licenseKey()
View source (opens new window)
Returns
string (opens new window), null (opens new window)
# logConfig()
- Since
- 3.0.18
Returns the log
component config.
View source (opens new window)
Returns
array (opens new window), null (opens new window)
# mailSettings()
- Since
- 3.1.0
Returns the system email settings.
View source (opens new window)
Returns
# mailerConfig()
- Since
- 3.0.18
Returns the mailer
component config.
View source (opens new window)
Arguments
$settings
(craft\models\MailSettings, null (opens new window)) – The system mail settings
Returns
# maxPowerCaptain()
Sets PHP’s memory limit to the maximum specified by the config3:phpMaxMemoryLimit (opens new window) config setting, and gives the script an unlimited amount of time to execute.
View source (opens new window)
# mutexConfig()
DEPRECATED
Deprecated in 3.5.0.
- Since
- 3.0.18
Returns a file-based mutex
component config.
TIP
If you were calling this to override the yii\mutex\FileMutex::$isWindows (opens new window) property, note that you
can safely remove your custom mutex
component config for Craft 3.5.0 and later. Craft now uses a
database-based mutex component by default (see dbMutexConfig()), which doesn’t care which type of
file system is used.
View source (opens new window)
Returns
# normalizeVersion()
Removes distribution info from a version
View source (opens new window)
Arguments
$version
(string (opens new window))
Returns
# phpConfigValueAsBool()
Retrieves a bool PHP config setting and normalizes it to an actual bool.
View source (opens new window)
Arguments
$var
(string (opens new window)) – The PHP config setting to retrieve.
Returns
boolean (opens new window) – Whether it is set to the php.ini equivelant of true
.
# phpConfigValueInBytes()
- Since
- 3.0.38
Retrieves a disk size PHP config setting and normalizes it into bytes.
View source (opens new window)
Arguments
$var
(string (opens new window)) – The PHP config setting to retrieve.
Returns
integer (opens new window), float (opens new window) – The value normalized into bytes.
# phpVersion()
Returns the PHP version, without the distribution info.
View source (opens new window)
Returns
# projectConfigConfig()
Returns the projectConfig
component config.
View source (opens new window)
# sessionConfig()
- Since
- 3.0.18
Returns the session
component config for web requests.
View source (opens new window)
Returns
# testIniSet()
- Since
- 3.0.40
Tests whether ini_set() works.
View source (opens new window)
Returns
# userConfig()
- Since
- 3.0.18
Returns the user
component config for web requests.
View source (opens new window)
Returns
# viewConfig()
- Since
- 3.0.18
Returns the view
component config.
View source (opens new window)
Returns
# webRequestConfig()
- Since
- 3.0.18
Returns the request
component config for web requests.
View source (opens new window)
Returns
# webResponseConfig()
- Since
- 3.3.0
Returns the response
component config for web requests.
View source (opens new window)
Returns
← Api ArrayHelper →