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
Requires
- php: ^7.0
- doctrine/inflector: ^1.1
- erusev/parsedown: ^1.6
- symfony/http-foundation: ^3.3 || ^4.0
- symfony/property-access: ^3.0 || ^4.0
- twig/twig: ^2.0
Requires (Dev)
- symfony/intl: ^3.0
- twig/extensions: ^1.4
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 #}