https://github.com/bpolaszek/twig-extensions
Some twig extensions.
https://github.com/bpolaszek/twig-extensions
Last synced: 3 months ago
JSON representation
Some twig extensions.
- Host: GitHub
- URL: https://github.com/bpolaszek/twig-extensions
- Owner: bpolaszek
- Created: 2016-04-05T13:46:34.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-05T13:52:44.000Z (almost 10 years ago)
- Last Synced: 2024-05-12T20:48:30.883Z (over 1 year ago)
- Language: PHP
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
BenToolsTwigExtensions
==========
Some helpful twig extensions.
> [!IMPORTANT]
> This repository is no longer maintained and may be removed in a near future. You may consider forking it.
Installation
---------
```
composer install bentools/twig-extensions
```
TypeOfExtension
---------
Provides basic PHP functions allowing to work with a variable type.
```twig
{# 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 %}
```