Skip to content

ProGestSA/twig-extension-callfunc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

twig-extension-callfunc

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]) }}

About

Twig extension to call PHP functions or static methods from templates

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages