dreipunktnull/twig-extensions

This package is abandoned and no longer maintained. No replacement package was suggested.

Useful twig extensions.

v1.0 2018-05-07 09:50 UTC

This package is auto-updated.

Last update: 2023-05-18 20:13:41 UTC


README

A collection of useful, generic twig extensions.

Installation

composer require dreipunktnull/twig-extensions

Configuration

Each extension needs to be added to your Twig_Environment.

HTML2Text

Convert HTML fragments to text with html2text.

$twig->addExtension(new Html2TextExtension());

or, if you use Symfony, tag a new service as twig.extension:

twig.extension.html2text:
    class: DPN\TwigExtensions\Extensions\Html2TextExtension
    tags:
        - { name: twig.extension }

Usage (Twig Filter)

{{ html_fragment | html2text }}

License

MIT