PHPackages                             district5/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. district5/filters

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

district5/filters
=================

District5 Filters Library

3.1.0(1y ago)01371mitPHPPHP &gt;=7.1

Since May 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/district-5/php-filters)[ Packagist](https://packagist.org/packages/district5/filters)[ Docs](https://github.com/district-5/php-filters)[ RSS](/packages/district5-filters/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (11)Used By (1)

[![codecov](https://camo.githubusercontent.com/29cebe641ac4dbe997afe6a5c4df0a99b58fd0e65a6b6d2878ae06e93220c3eb/68747470733a2f2f636f6465636f762e696f2f67682f64697374726963742d352f7068702d66696c746572732f67726170682f62616467652e7376673f746f6b656e3d36423634464338475259)](https://codecov.io/gh/district-5/php-filters)

PHP Filters
===========

[](#php-filters)

A collection of filters implementing the [District5 Filter](https://github.com/district-5/php-filter) interface.

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

[](#installation)

Install using composer:

```
composer require district5/filters
```

Usage
-----

[](#usage)

All filters in this library conform to the [District5 Filter](https://github.com/district-5/php-filter) interface. All can be used in the same way:

```
$value = 'Hello';

$filter = new \District5\Filters\StringLower();
$filteredValue = $filter->filter($value);   // 'hello'
```

These filters do not guarantee consistent return filtered items if the input has not been validated first, for example `ArrayOfStringToInt` relies on the strings being a value that can be converted as `intval` is utilised.

You should validate input first; these filters can then be used to add business logic to the validated data. If for example you wanted to store hex colour codes but allow users the flexibility of either including or omitting the #, you would need to validate that the string is indeed a hex code, and then run it through the filter to make sure you always utilise / persist the codes consistently.

To make use of this combined functionality please see Validation Groups library.

### Available Filters

[](#available-filters)

- Array of strings to lower case
- Array of strings to upper case
- Array of strings to integers
- Array of strings to an array of the unique values
- Array of strings with all strings trimmed
- String to lower case
- String to upper case
- String trim
- String to UCS Words

Issues
------

[](#issues)

Log a bug report!

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

Every ~254 days

Recently: every ~573 days

Total

10

Last Release

619d ago

Major Versions

1.4.0 → 3.0.02024-02-26

PHP version history (2 changes)1.0.0PHP &gt;=5.4.0

3.0.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/5de4b9a90eadf6b595e1b5efc802683f2358da5661c616820b90c922f8aa8e05?d=identicon)[rogerthomas84](/maintainers/rogerthomas84)

![](https://www.gravatar.com/avatar/c566343bfe6b0a3602622dd1def882992f10ff114b6a95ffb000da2ba9e22578?d=identicon)[mark-morgan](/maintainers/mark-morgan)

---

Top Contributors

[![mark-morgan](https://avatars.githubusercontent.com/u/1934581?v=4)](https://github.com/mark-morgan "mark-morgan (41 commits)")

---

Tags

phpfiltersdistrict5

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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