symfony upgrade fixer ā¢
twig gettext extractor ā¢
wisdom ā¢
centipede ā¢
permissions handler ā¢
extraload ā¢
gravatar ā¢
locurro ā¢
country list ā¢
transliterator
, (*1)
Twig PHP Function
Call (almost) any PHP function from your Twig templates., (*2)
Usage
After registering PhpFunctionExtension
call PHP functions from your templates like this:, (*3)
Hi, I am unique: {{ uniqid() }}.
And {{ floor(7.7) }} is floor of 7.7.
Extend
You can control allowed PHP functions by adding new ones like this:, (*4)
$extension = new Umpirsky\Twig\Extension\PhpFunctionExtension();
$extension->allowFunction('hash_hmac');
or restrict what functions are allowed like this:, (*5)
$extension = new Umpirsky\Twig\Extension\PhpFunctionExtension(['floor', 'ceil']);
If you think that some function should be allowed/not allowed, feel free to raise issue or submit a pull request., (*6)