dzango/twig-truncate-bundle

A Symfony bundle to include the TwigTruncateExtension into your app.

Installs: 16 664

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 1

Open Issues: 0

Type:symfony-bundle

1.0.5 2020-06-04 08:43 UTC

This package is auto-updated.

Last update: 2024-04-04 19:16:52 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.