---
title: "Constant ViewHelper <f:constant>"
manual: "Fluid Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/fluid:typo3fluid-fluid-constant"
source: "ViewHelpers/Fluid/Constant.rst"
rendered: "2026-10-08T14:12:40+00:00"
---

# Constant ViewHelper `<f:constant>` {#typo3fluid-fluid-constant}

> [!NOTE]
> This reference is part of the documentation of Fluid Standalone.
> If you are working with Fluid in TYPO3 CMS, please refer to
> [TYPO3's ViewHelper reference](https://docs.typo3.org/other/typo3/view-helper-reference/14.3/en-us/Global/Constant.html) instead.

Wrapper for PHPs `constant` function.
See [https://www.php.net/manual/function.constant.php](https://www.php.net/manual/function.constant.php).

## Examples {#examples}

### Get built-in PHP constant {#get-built-in-php-constant}

```php
{f:constant(name: 'PHP_INT_MAX')}

```

Output:

```php
9223372036854775807
(Depending on CPU architecture).

```

### Get class constant {#get-class-constant}

```php
{f:constant(name: '\Vendor\Package\Class::CONSTANT')}

```

### Get enum case {#get-enum-case}

```php
{f:constant(name: '\Vendor\Package\Enum::CASE')}
```

Go to the source code of this ViewHelper: [ConstantViewHelper.php (GitHub)](https://github.com/TYPO3/Fluid/blob/main/src/ViewHelpers/ConstantViewHelper.php).

**Arguments**

The following arguments are available for the constant ViewHelper:

-   **name**

    -   *Type:* string

    String representation of a PHP constant or enum
