PHPackages                             thewilkybarkid/text-filter - 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. thewilkybarkid/text-filter

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

thewilkybarkid/text-filter
==========================

Standardised text filter interface

v1.0.0(12y ago)022MITPHPPHP &gt;=5.3.3

Since Apr 2Pushed 12y ago1 watchersCompare

[ Source](https://github.com/thewilkybarkid/text-filter)[ Packagist](https://packagist.org/packages/thewilkybarkid/text-filter)[ Docs](https://github.com/thewilkybarkid/text-filter)[ RSS](/packages/thewilkybarkid-text-filter/feed)WikiDiscussions master Synced 2mo ago

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

TextFilter
==========

[](#textfilter)

[![Build Status](https://camo.githubusercontent.com/9196fec874434be6e77f88a73c57a2cebe402aa6d024cbb4a73ca0a4f21d4659/68747470733a2f2f7472617669732d63692e6f72672f74686577696c6b796261726b69642f746578742d66696c7465722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/thewilkybarkid/text-filter)

This library provides a standard interface (`TheWilkyBarKid\TextFilter\TextFilter`) for text filters. The interface defines a single method, `filter()`, which takes a string and returns a (presumably modified) string.

That in itself isn't particularly useful, but it does open up some interesting possibilities.

It also provides some adapters, allowing you to indirectly use libraries through the interface.

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

[](#installation)

1. Add TextFilter to your dependencies:

    ```
    // composer.json

    {
       // ...
       "require": {
           // ...
           "thewilkybarkid/text-filter": "~1.0"
       }
    }

    ```
2. Use Composer to download and install TextFilter:

    ```
    $ php composer.phar update thewilkybarkid/text-filter

    ```

Chaining filters
----------------

[](#chaining-filters)

The `TheWilkyBarKid\TextFilter\TextFilterChain` class takes any number of text filters and runs through them one after another (in a user-controlled order).

This allows you to build a potentially-lengthy chain of filters, simplifying your logic when actually using them:

```
$filter = new TextFilterChain(array($markdownFilter, $smartyPantsFilter, $htmlPurifierFilter));

// later on
$output = $filter->filter('some markdown');

```

Caching filters
---------------

[](#caching-filters)

Normally you should persist the result of your filters alongside the plain input to avoid running it through potentially expensive filters at runtime. As this isn't always possible, the `TheWilkyBarKid\TextFilter\DoctrineCacheTextFilterWrapper` class wraps a text filter and caches the result in a Doctrine cache driver (file-based, Memcache, Redis etc).

```
$chain = new TextFilterChain(array($markdownFilter, $smartyPantsFilter, $htmlPurifierFilter));
$filter = new DoctrineCacheTextFilterWrapper($cache, $chain));

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4420d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e6aaeba393e9038b5a5a916e5f4e32ffb349436e3be2027be4828f486bc8c9d?d=identicon)[thewilkybarkid](/maintainers/thewilkybarkid)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/thewilkybarkid-text-filter/health.svg)

```
[![Health](https://phpackages.com/badges/thewilkybarkid-text-filter/health.svg)](https://phpackages.com/packages/thewilkybarkid-text-filter)
```

###  Alternatives

[unisolutions/silverstripe-copybutton

Adds copy button to the GridField.

1736.4k](/packages/unisolutions-silverstripe-copybutton)[shomisha/stubless

A package for generating PHP files without stubs.

397.1k3](/packages/shomisha-stubless)[sagautam5/local-states-nepal

PHP Package for data set of local states of Nepal

334.7k](/packages/sagautam5-local-states-nepal)

PHPackages © 2026

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