PHPackages                             phile/twig-filters - 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. phile/twig-filters

ActivePhile-plugin[Templating &amp; Views](/categories/templating)

phile/twig-filters
==================

An example plugin for Phile showing how to make Twig filters.

1.1.0(8y ago)0661MITPHP

Since May 6Pushed 8y ago2 watchersCompare

[ Source](https://github.com/PhileCMS/phileTwigFilters)[ Packagist](https://packagist.org/packages/phile/twig-filters)[ Docs](http://philecms.com)[ RSS](/packages/phile-twig-filters/feed)WikiDiscussions master Synced today

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

Twig Functions
==============

[](#twig-functions)

[![Build Status](https://camo.githubusercontent.com/b5bf70bce2a92df5a4a86d230b1143971de4d320ca1b9518834c5eb3ea73a90b/68747470733a2f2f7472617669732d63692e6f72672f5068696c65434d532f7068696c655477696746696c746572732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/PhileCMS/phileTwigFilters)

Adds helpfull Twig functions to [Phile](https://github.com/PhileCMS/Phile) and easily allows you to create new ones. [Project home](https://github.com/PhileCMS/phileTwigFilters).

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

[](#installation)

```
composer require phile/twig-functions
```

Activation
----------

[](#activation)

```
$config['plugins']['phile\\twigFunctions'] = [
    'active' => true
];
```

Usage
-----

[](#usage)

This plugin includes some predefined Twig-filter and allows you to easily add your own.

### Define a New Custom Filter

[](#define-a-new-custom-filter)

See the existing filters in config.php for how to add your own filter.

### excerpt

[](#excerpt)

Grabs the first paragraph of the content string.

```
{{ content|excerpt }}
```

### limit\_words

[](#limit_words)

Similar to `excert` but limits on number of words. Use Twig's `striptags` to remove HTML-tags.

```
{{ page.content|striptags|limit_words }}
```

### shuffle

[](#shuffle)

Shuffles an array. For example show a shuffled lists of pages:

```

  {% for page in pages|shuffle %}
    {{ page.title }}
  {% endfor %}

```

### slugify

[](#slugify)

This new Twig filter allows you to slugify a string. This is useful for making safe URLs, HTML-safe class/id names, or just cleaning up general strings.

```

{{ "This Is ____an STRÄNGE      string" | slugify }}
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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.

###  Release Activity

Cadence

Every ~1058 days

Total

2

Last Release

2963d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e96d91f6220abcbbf2e6bcd12988b11330178e08a33cd663e813257a359b12fc?d=identicon)[NeoBlack](/maintainers/NeoBlack)

---

Top Contributors

[![james2doyle](https://avatars.githubusercontent.com/u/1425304?v=4)](https://github.com/james2doyle "james2doyle (6 commits)")[![NeoBlack](https://avatars.githubusercontent.com/u/1128085?v=4)](https://github.com/NeoBlack "NeoBlack (3 commits)")[![Schlaefer](https://avatars.githubusercontent.com/u/143224?v=4)](https://github.com/Schlaefer "Schlaefer (3 commits)")

---

Tags

philecms-plugintwigphile

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phile-twig-filters/health.svg)

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

###  Alternatives

[twig/extra-bundle

A Symfony bundle for extra Twig extensions

91292.0M313](/packages/twig-extra-bundle)[twig/intl-extra

A Twig extension for Intl

36663.2M218](/packages/twig-intl-extra)[twig/string-extra

A Twig extension for Symfony String

21946.0M132](/packages/twig-string-extra)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

23018.5M53](/packages/twig-cssinliner-extra)[symfony/ux-twig-component

Twig components for Symfony

21814.8M161](/packages/symfony-ux-twig-component)[twig/markdown-extra

A Twig extension for Markdown

12114.3M83](/packages/twig-markdown-extra)

PHPackages © 2026

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