progest/twig-extension-callfunc

Twig extension to call PHP functions or static methods from templates

Installs: 1 341

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/progest/twig-extension-callfunc

1.2 2019-03-21 11:15 UTC

This package is auto-updated.

Last update: 2025-09-22 02:04:25 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]) }}