bentools/twig-extensions

Some twig extensions

v1.0 2016-04-05 13:51 UTC

This package is auto-updated.

Last update: 2024-03-14 22:34:47 UTC


README

Some helpful twig extensions.

Installation

composer install bentools/twig-extensions

TypeOfExtension

Provides basic PHP functions allowing to work with a variable type.

{# Filters #}
{{ value | typeOf }}
{{ value | getType }}

{# Functions #}
{% if get_type(value) == 'array' %}
    ...    
{% endif %}

{% if is_bool(value) %}
    ...    
{% endif %}

{% if is_string(value) %}
    ...    
{% endif %}

{% if is_numeric(value) %}
    ...    
{% endif %}

{% if is_int(value) %}
    ...    
{% endif %}

{% if is_float(value) %}
    ...    
{% endif %}

{% if is_null(value) %}
    ...    
{% endif %}

{% if is_array(value) %}
    ...    
{% endif %}

{% if is_object(value) %}
    ...    
{% endif %}

{% if is_scalar(value) %}
    ...    
{% endif %}

{% if is_callable(value) %}
    ...
{% endif %}