PHPackages                             funcphp/twig-compress - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. funcphp/twig-compress

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

funcphp/twig-compress
=====================

Output compressor for twig

115.3k↓35.4%11PHP

Since Dec 26Pushed 8y ago1 watchersCompare

[ Source](https://github.com/emr/twig-compress)[ Packagist](https://packagist.org/packages/funcphp/twig-compress)[ RSS](/packages/funcphp-twig-compress/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (1)

twig-compress
=============

[](#twig-compress)

output**compressor**for**twig**butbetterthan`{% spaceless %}`

install
-------

[](#install)

download repo

```
$ composer require funcphp/twig-compress "dev-master"

```

##### without symfony:

[](#without-symfony)

```
// add extension to your twig engine
$twigEngine->addExtension(new \Func\Twig\CompressExtension());
```

##### with symfony:

[](#with-symfony)

enable bundle

```
$bundles = [
    ...
    new \Func\CompressBundle\FuncCompressBundle(),
    ...
];
```

examples
--------

[](#examples)

#### basic usage

[](#basic-usage)

```
{% compress %}

            body {
                background: #fcc200;
            }

            alert('hello')

{% endcompress %}
```

**output:**

```
 body { background: #fcc200; }  alert('hello')
```

#### use with secure option

[](#use-with-secure-option)

this does the same thing with `{% spaceless %}`

```
{% compress not secure %}

            body {
                background: #fcc200;
            }

            alert('hello')

{% endcompress %}
```

you can use `{% compress secure=false %}` instead of `{% compress not secure %}`

**output:**

```

            body {
                background: #fcc200;
            }

            alert('hello')

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/26738231?v=4)[emreakinci](/maintainers/emreakinci)[@emreakinci](https://github.com/emreakinci)

---

Top Contributors

[![emr](https://avatars.githubusercontent.com/u/7689512?v=4)](https://github.com/emr "emr (4 commits)")

---

Tags

compressionhtmlphpsymfony-bundle

### Embed Badge

![Health badge](/badges/funcphp-twig-compress/health.svg)

```
[![Health](https://phpackages.com/badges/funcphp-twig-compress/health.svg)](https://phpackages.com/packages/funcphp-twig-compress)
```

###  Alternatives

[symfony/event-dispatcher

Provides tools that allow your application components to communicate with each other by dispatching events and listening to them

8.5k985.9M3.4k](/packages/symfony-event-dispatcher)[symfony/polyfill-intl-grapheme

Symfony polyfill for intl's grapheme\_\* functions

1.7k702.8M27](/packages/symfony-polyfill-intl-grapheme)[seld/phar-utils

PHAR file format utilities, for when PHP phars you up

875180.0M32](/packages/seld-phar-utils)[phpdocumentor/graphviz

Wrapper for Graphviz

9811.3M21](/packages/phpdocumentor-graphviz)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
