PHPackages                             graze/array-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. graze/array-filter

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

graze/array-filter
==================

File manipulation

v1.0.1(10y ago)03961MITPHPPHP &gt;=5.6.0

Since Feb 19Pushed 5y ago11 watchersCompare

[ Source](https://github.com/graze/array-filter)[ Packagist](https://packagist.org/packages/graze/array-filter)[ Docs](https://github.com/graze/array-filter)[ RSS](/packages/graze-array-filter/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (1)

array-filter
============

[](#array-filter)

[![](https://camo.githubusercontent.com/94a990c4567b9dfd3e1b0cbaeafd3bd20280fd7a64740fcf0b6f4f319aa1f907/68747470733a2f2f6d65646961322e67697068792e636f6d2f6d656469612f6c34316c4f6d34646131417672357569342f67697068792e676966)](https://camo.githubusercontent.com/94a990c4567b9dfd3e1b0cbaeafd3bd20280fd7a64740fcf0b6f4f319aa1f907/68747470733a2f2f6d65646961322e67697068792e636f6d2f6d656469612f6c34316c4f6d34646131417672357569342f67697068792e676966)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4f424ab545b0ad6218146ab916d20607c595fe09395b52fd2394febd7a3a6d3f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6772617a652f61727261792d66696c7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/graze/array-filter)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/37329a7dac9bb23ea8b1fcd9526b455e9a9b1c38316637e5418e664ef59abae7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6772617a652f61727261792d66696c7465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/graze/array-filter)[![Coverage Status](https://camo.githubusercontent.com/6485b9ad90a4d2636e8e8b1de67cca02651b9bd7043d4bfd5ee17db126f9c50c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6772617a652f61727261792d66696c7465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/graze/array-filter/code-structure)[![Quality Score](https://camo.githubusercontent.com/0815633979fbd328f16fca41a825b9f833a8802c38b5681d9926ed7adaf7f579/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6772617a652f61727261792d66696c7465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/graze/array-filter)[![Total Downloads](https://camo.githubusercontent.com/feca9908db41330ee8704b233a0e28f57b49ecbf2273a0610dc6912743644f3e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6772617a652f61727261792d66696c7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/graze/array-filter)

Array Filtering

Install
-------

[](#install)

Via Composer

```
$ composer require graze/array-filter
```

Usage
-----

[](#usage)

### Filter Factory

[](#filter-factory)

There is a factory which takes in a set of string definitions and creates filters based on each one

```
$config = [
    'name ~' => '/test.*/i',
    'ctime >' => '{date:yesterday:U}',
    'status in' => [1, 2],
];
$input = [[
    'name' => 'test1234',
    'ctime' => 142353782,
    'status' => 2,
]];
$factory = new FilterFactory(new ValueFactory());
$filter = $factory->createFilters($config);
$filtered = array_filter($input, $filter);
```

### Respect/Validator and other callable functions Compatible

[](#respectvalidator-and-other-callable-functions-compatible)

```
$filter = new AllOfFilter();
$filter->addFilter(new ClosureFilter('name', v::regex('/test.*/i')))
       ->addFilter(v::key('ctime', v::date()->between('yesterday', 'today'))
       ->addFilter(function (array $data) {
           return isset($data['status']) && in_array($data['status'], [1, 2]);
       });

$filtered = array_filter($input, $filter);

```

Testing
-------

[](#testing)

```
$ make
$ make test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Harry Bragg](https://github.com/h-bragg)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

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

Total

3

Last Release

3780d ago

Major Versions

v0.1 → v1.02016-02-22

PHP version history (2 changes)v0.1PHP &gt;=5.5.0

v1.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/637788?v=4)[graze.com](/maintainers/graze)[@graze](https://github.com/graze)

---

Tags

grazearray-filter

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/graze-array-filter/health.svg)

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

###  Alternatives

[graze/telnet-client

Telnet client written in PHP

48242.5k4](/packages/graze-telnet-client)

PHPackages © 2026

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