progest / twig-extension-callfunc
Twig extension to call PHP functions or static methods from templates
Installs: 1 121
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
- twig/twig: >=2.4
This package is auto-updated.
Last update: 2025-06-22 01:22:53 UTC
README
Twig extension to call PHP functions or static methods from templates
Installation:
# $twig being your Twig_Environment object $twig->addExtension(new \ProGest\Twig\CallFuncExtension());
Usage:
# Call function
{{ callfunc('myFunction') }}
# Call static method
{{ callfunc('myClass::myStaticMethod') }}
# Pass one or multiple arguments
{{ callfunc('myFunction', 8546) }}
{{ callfunc('myFunction', ['testValue', 9897]) }}