ruvents/twig-extensions

This package is abandoned and no longer maintained. No replacement package was suggested.

RUVENTS Twig Extensions

3.2.2 2018-03-07 10:07 UTC

README

Class Extension

Helps to work with objects

instanceof(class_name) test

{% if object is instanceof('Namespace\\Class') %}
{% endif %}

Inflector Extension

Is useful for transforming strings. Internally uses the Doctrine Inflector library.

|underscorize filter

{{ 'aliceInChains'|underscorize }} {# prints: alice_in_chains #}
{{ 'AliceInChains'|underscorize }} {# prints: alice_in_chains #}

|classify filter

{{ 'alice_in_chains'|classify }} {# prints: AliceInChains #}
{{ 'aliceInChains'|underscorize }} {# prints: AliceInChains #}

|camelize filter

{{ 'alice_in_chains'|camelize }} {# prints: aliceInChains #}
{{ 'AliceInChains'|camelize }} {# prints: aliceInChains #}

|ucwords(delimiters=" \n\t\r\0\x0B-") filter

Uppercases words with configurable delimeters between words

{{ 'hello sean'|ucwords }} {# prints: Hello Sean #}