PHPackages                             marcj/twig-apply\_filter-bundle - 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. [Templating &amp; Views](/categories/templating)
4. /
5. marcj/twig-apply\_filter-bundle

ActiveLibrary[Templating &amp; Views](/categories/templating)

marcj/twig-apply\_filter-bundle
===============================

Dynamic twig filter calls

0.1.0(12y ago)510.7k2[1 issues](https://github.com/marcj/twig-apply_filter-bundle/issues)[1 PRs](https://github.com/marcj/twig-apply_filter-bundle/pulls)MITPHP

Since Dec 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/marcj/twig-apply_filter-bundle)[ Packagist](https://packagist.org/packages/marcj/twig-apply_filter-bundle)[ RSS](/packages/marcj-twig-apply-filter-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Twig apply\_filter
==================

[](#twig-apply_filter)

This filter allows you to call dynamic filters in twig.

[![Build Status](https://camo.githubusercontent.com/9664385ec9792626336fc78d7194be13a68d624e79249e79fc26c1c154711bb9/68747470733a2f2f7472617669732d63692e6f72672f6d6172636a2f747769672d6170706c795f66696c7465722d62756e646c652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/marcj/twig-apply_filter-bundle)

Examples
--------

[](#examples)

```
{{ set filters = 'upper|nl2br' }}

{{ value|apply_filter(filters) }}

{{ value|apply_filter("default('abc')|json_encode") }}
```

A filter for e.g. a News system, where the title filter is stored in the database:

```
{% for item in newsItems %}
    {{ item.title|apply_filter(databaseSettings.newsFilter) }}
{% endfor %}
```

Installation
------------

[](#installation)

### Install via composer

[](#install-via-composer)

```
composer.phar require marcj/twig-apply_filter-bundle
```

### Activate bundle

[](#activate-bundle)

Open your AppKernel.php

```
