dzango/twig-truncate-bundle

A Symfony bundle to include the TwigTruncateExtension into your app.

Installs: 8 627

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 1

Open Issues: 0

Type:symfony-bundle

1.0.5 2020-06-04 08:43 UTC

This package is auto-updated.

Last update: 2020-09-04 11:51:32 UTC


README

A Symfony bundle to include the TwigTruncateExtension into your app. The TwigTruncateExtension allows you to truncate text while preserving HTML tags.

Installation

Add the bundle to your app's composer.json:

    "require": {
        "dzango/twig-truncate-bundle": "^1.0",
        ...
    }

Enable the bundle in your app's Appkernel(Only for symfony projects below 4):

# app/AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
        	...
            new Dzango\Bundle\TwigTruncateBundle\TwigTruncateBundle(),
            ...
        );

Note:

For symfony 4 and above the bundle will automatically enabled in your app. In case the bundle does not enabled, add it to bundle list.

#config/bundles.php
return [
    ...
    Dzango\Bundle\TwigTruncateBundle\TwigTruncateBundle::class => ['all' => true],
]

Usage

See the TwigTruncateExtension's documentation.