dreipunktnull / twig-extensions
Useful twig extensions.
Installs: 88
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/dreipunktnull/twig-extensions
Requires
- soundasleep/html2text: ^0.5.0
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