glazilla/slim-twig-flash
最新稳定版本:v1.0
Composer 安装命令:
composer require glazilla/slim-twig-flash
包简介
A Twig extension to access Slim Flash messages in templates
README 文档
README
A Twig extension to access Slim Flash messages in templates.
Install
Via Composer
composer require glazilla/slim-twig-flash
Requires:
- PHP 8 or newer
- Slim Framework Flash Messages 0.4.0 or newer
- Twig 3.4.3 or newer
Usage
- Add extension to your twig views
...
$view->addExtension(new Glazilla\Slim\Views\TwigMessages(
new Slim\Flash\Messages()
));
...
- In templates use
flash()orflash('some_key')to fetch messages from Flash service
...
<ul class="alert alert-danger">
{% for msg in flash('error') %}
<li>{{ msg }}</li>
{% endfor %}
</ul>
...
Testing
phpunit
License
The GNU GENERAL PUBLIC LICENSE Version 3. Please see License File for more information.
统计信息
- 总下载量: 1.38k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2022-11-10