Constant ViewHelper <f:constant>

Wrapper for PHPs constant function. See https://www.php.net/manual/function.constant.php.

Examples

Get built-in PHP constant

{f:constant(name: 'PHP_INT_MAX')}
Copied!

Output:

9223372036854775807
(Depending on CPU architecture).
Copied!

Get class constant

{f:constant(name: '\Vendor\Package\Class::CONSTANT')}
Copied!

Get enum case

{f:constant(name: '\Vendor\Package\Enum::CASE')}
Copied!

Source code

Go to the source code of this ViewHelper: ConstantViewHelper.php (GitHub).

Arguments

The following arguments are available for the constant ViewHelper:

name

name
Type
string
String representation of a PHP constant or enum