pongtan/twig-php-function
最新稳定版本:v0.1
Composer 安装命令:
composer require pongtan/twig-php-function
包简介
Call (almost) any PHP function from your Twig templates.
README 文档
README
symfony upgrade fixer • twig gettext extractor • wisdom • centipede • permissions handler • extraload • gravatar • locurro • country list • transliterator
Twig PHP Function 
Call (almost) any PHP function from your Twig templates.
Usage
After registering PhpFunctionExtension call PHP functions from your templates like this:
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:
$extension = new Umpirsky\Twig\Extension\PhpFunctionExtension(); $extension->allowFunction('hash_hmac');
or restrict what functions are allowed like this:
$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.
统计信息
- 总下载量: 16.54k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-23