# Class yii\twig\Template

Inheritance | yii\twig\Template
Source Code | https://github.com/yiisoft/yii2-twig/blob/master/Template.php

Template helper

## Public Methods

Hide inherited methods

Method | Description | Defined By
--- | --- | ---
attribute() | Returns the attribute value for a given array/object. | yii\twig\Template

## Method Details

attribute() public static method

Returns the attribute value for a given array/object.

public static mixed attribute ( \Twig\Environment $env, \Twig\Source $source, $object, $item, array $arguments = [], \yii\twig\string $type = \Twig\Template::ANY_CALL, \yii\twig\bool $isDefinedTest = false, \yii\twig\bool $ignoreStrictCheck = false )
$env | \Twig\Environment |
$source | \Twig\Source |
$object | mixed | The object or array from where to get the item
$item | mixed | The item to get from the array or object
$arguments | array | An array of arguments to pass if the item is an object method
$type | string | The type of attribute (@see Twig_Template constants)
$isDefinedTest | boolean | Whether this is only a defined check
$ignoreStrictCheck | boolean | Whether to ignore the strict attribute check or not
return | mixed | The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true
throws | \Twig\Error\RuntimeError | if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false