tangoman/truncate-html-bundle

Symfony Truncate Html Twig Extention Bundle


Keywords
symfony, twig, bundle, extension, service, TangoMan, Truncate Html
License
MIT

Documentation

Tangoman TruncateHtml Twig Service

Tangoman TruncateHtml Twig Service truncates html keeping tags.

How to install

With composer

$ composer require tangoman/truncate-html-bundle

Enable the bundle

Don't forget to enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new TangoMan\TruncateHtml\TangoManTruncateHtml(),
    );
}

You don't have to add TangoMan CallbackBundle to the service.yml of your project. twig.extension.truncate_html service should load automatically.

How to use

Inside your views:

    <p>
        {{ post.html|truncatehtml }}
    </p>

Note

If you find any bug please report here : Issues

License

Copyright (c) 2018 Matthias Morin

License Distributed under the MIT license.

If you like TangoMan TruncateHtml please star! And follow me on GitHub: TangoMan75 ... And check my other cool projects.

tangoman.free.fr