Search by

ocubom / twig-extra-bundle

ocubom

A Symfony bundle for custom extra Twig extensions

Package info

github.com/ocubom/twig-extra-bundle

Homepage

Type:symfony-bundle

pkg:composer/ocubom/twig-extra-bundle

Statistics

Installs: 352

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v1.6.0 2026-09-03 10:22 UTC

This package is auto-updated.

Last update: 2026-09-03 10:31:30 UTC


README

ocubom/twig-extra-bundle

A Symfony bundle for custom extra Twig extensions.

Version PHP version License Build status Coverage

Downloads Issues Stargazers Forks Contributors

Explore the docs » · Report Bug · Request Feature

Table of Contents

About ocubom/twig-extra-bundle

ocubom/twig-extra-bundle allows the use of several custom Twig extensions with zero configuration.

This suite started as an internal helper based on nochso/html-compress-twig to bring wyrihaximus/html-compress support to Twig 3.0. Over time, as several projects embedded and modified this class independently, development became fragmented and difficult to maintain. To resolve this, several standalone open-source extensions were created to unify those efforts.

This repository provides a Symfony bundle to easily integrate all those extensions into a Symfony project. The bundle continues to evolve to configure additional custom extensions, following the philosophy of twig/extra-bundle.

Getting Started

Prerequisites

  • PHP >= 7.4 (tested up to 8.5)
  • Composer >= 2.0

Installation

Install the package via composer:

composer require ocubom/twig-extra-bundle

You must also install the Twig extensions you want to use:

# For HTML filters (`html_attributes`, `html_minify`)
composer require ocubom/twig-html-extension

# For SVG filters (`svg`, `svg_symbols`, `fontawesome`, `iconify`)
composer require ocubom/twig-svg-extension

Optional Dependencies

You can install additional packages to plug extra functionality:

composer require matthiasmullie/minify  ## scripts & styles
composer require wikimedia/minify       ## scripts & styles
composer require tedivm/jshrink         ## scripts only
composer require tubalmartin/cssmin     ## styles only
composer require enshrined/svg-sanitize

Usage

Enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

// config/bundles.php

return [
    // ...
    Ocubom\TwigExtraBundle\OcubomTwigExtraBundle::class => ['all' => true],
];

Just create the file config/packages/ocubom_twig_extra.yaml using the configuration reference:

bin/console config:dump-reference ocubom_twig_extra

Or you can use the example configuration provided.

Note

This configuration will be installed if your project uses endroid/installer

Roadmap

See the open issues for a list of proposed features (and known issues).

Support

Reach out to the maintainer at GitHub Issues.

Authorship

Oscar Cubo Medinahttps://ocubom.github.io

For a full list of all authors and contributors, see the contributors page.

License

Distributed under the MIT License.

See LICENSE for more information.