PHPackages                             reichwebconsulting/array-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. [Search &amp; Filtering](/categories/search)
4. /
5. reichwebconsulting/array-filters

ActiveLibrary[Search &amp; Filtering](/categories/search)

reichwebconsulting/array-filters
================================

A library of useful array filtering features.

1.1.5(7y ago)069MITPHPPHP &gt;=7.1.0

Since Jan 16Pushed 7y ago1 watchersCompare

[ Source](https://github.com/reichwebconsulting/array-filters)[ Packagist](https://packagist.org/packages/reichwebconsulting/array-filters)[ RSS](/packages/reichwebconsulting-array-filters/feed)WikiDiscussions master Synced 2mo ago

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

[![Build Status](https://camo.githubusercontent.com/ca845e8eea39386523a7469aa4d7c53a8d7c72806e8745a559befa4a37716430/68747470733a2f2f7472617669732d63692e6f72672f7265696368776562636f6e73756c74696e672f61727261792d66696c746572732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/reichwebconsulting/array-filters)

reichwebconsulting/array-filters
================================

[](#reichwebconsultingarray-filters)

reichwebconsulting/array-filters is a PHP 7.1+ library for array filtering.

This project began as part of a hydration/extraction library, but I realized the components had broad use across numeric projects I work on. The library contains an interface called `FilterInterface` that describes an interface for passing arrays and returning modified versions of those arrays.

The `ExcludeFieldsFilter` provides the ability to remove key/value pairs from the input array by specifying keys to exclude. This filter is useful when you have an array of data to return but need to filter out sensitive fields based on the context. For example, `ExcludeFieldsFilter` could be used to filter out the "password" and "email" fields from user records before returning them in a result set.

The `KeyMutatorFilter` provides the ability to modify array keys based on any logic you code into a `callable` function you assign to the filter. The output array will contain all of the same values as the input array, but assigned to keys generates using the configured callback function. The `KeyMutatorFilter` is useful when you have an array of data whose keys need to be in a slightly different format before they are useful for the next phase of code. A good example is when PostgreSQL result sets, whose properties are all lowercase--a convention that is rarely followed within PHP.

The `KeyPrefixFilter` provides the ability to add prefixes to all of the array keys. A great use case for `KeyPrefixFilter` is when you have a result set you would like to map onto a `PDOStatement` parameter list. PDO parameters begin with a colon, so just use KeyPrefixFilter to add a colon to your keys before using the array as your PDO statement parameters.

Getting Started
---------------

[](#getting-started)

To start using `reichwebconsulting/array-filters` install Composer and then run the following command:

```
composer require reichwebconsulting/array-filters

```

### Prerequisites

[](#prerequisites)

PHP 7.1+ and Composer required. PHPUnit is required to run the test suite.

### Installing

[](#installing)

```
composer require reichwebconsulting/array-filters

```

Running the tests
-----------------

[](#running-the-tests)

This library strives for 100% code coverage. Tests can be run by switching to the `phpunit` directory and running `phpunit`.

```
cd phpunit
phpunit

```

Versioning
----------

[](#versioning)

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).

Authors
-------

[](#authors)

- **Brian Reich** - *Initial work* - [Reich Web Consulting](https://github.com/reichwebconsulting)

See also the list of [contributors](https://github.com/reichwebconsulting/array-filters/contributors) who participated in this project.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity62

Established project with proven stability

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 ~45 days

Recently: every ~57 days

Total

6

Last Release

2809d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/094902606806c697d6eb15794e0db692dc37f5bed9c7ce1af8968aefbd6c48be?d=identicon)[reichwebconsulting](/maintainers/reichwebconsulting)

---

Tags

phpfilterarrays

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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