Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 1.13 KB

README.md

File metadata and controls

53 lines (39 loc) · 1.13 KB

Slim Twig Flash

A Twig extension to access Slim Flash messages in templates.

master develop
Build Status Build Status

Install

Via Composer

composer require kanellov/slim-twig-flash

Requires:

  • PHP 5.5.0 or newer
  • Slim Framework Flash Messages 0.1.0 or newer
  • Twig 1.18.0 or newer

Usage

  • Add extension to your twig view
...
$view->addExtension(new Knlv\Slim\Views\TwigMessages(
    new Slim\Flash\Messages()
));
...
  • In templates use flash() or flash('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.