PHPackages                             bermudaphp/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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. bermudaphp/filter

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

bermudaphp/filter
=================

v1.0(1y ago)001MITPHPPHP ^8.4

Since May 5Pushed 1y ago1 watchersCompare

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

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

PHP Iterable Filter Library
---------------------------

[](#php-iterable-filter-library)

This library provides a robust and extensible set of filters to process and filter iterable data sources in PHP. Its design follows a consistent interface that makes it easy to apply custom filtering logic to collections (arrays, Traversable, etc.). With immutable filter instances and a fluent API, you can chain and compose filters to build complex filtering rules easily.

Features
--------

[](#features)

Flexible Filtering Interface: The library defines a common FilterInterface that extends both \\IteratorAggregate and Arrayable, so you can directly iterate over filtered results and convert them to arrays.

Abstract Base Class: The AbstractFilter class implements most of the common functionality, including a generator-based iterator (getIterator()) and an immutable withIterable() method for setting the data source.

Wide Range of Built-in Filters: The library includes filters for various use cases, including:

Value-based Filters: EqualsFilter, NotEqualsFilter, EmptyFilter, NotEmptyFilter, StringEqualsFilter, and many more.

Numeric Filters: GreaterThanFilter, LessThanFilter, GreaterThanEqualsFilter, LessThanEqualsFilter, as well as range filters.

Array Filters: Filters using PHP’s built-in functions such as array\_intersect, array\_diff, etc.

Key-based Filters: Filters that compare only the element's key (e.g., KeyIntersectFilter, KeyContainsFilter, KeyRegexFilter, etc.).

Object Property Filters: e.g. PropertyExistsFilter.

Composite Filters: Easily combine multiple filters using a composite pattern (e.g., ChanableFilter).

Easy to Extend: Creating a custom filter is as simple as extending the AbstractFilter class and implementing the accept() method.

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

[](#installation)

```
composer require bermudaphp/filter
```

Usage
-----

[](#usage)

```
$nonFiltered = [1, 2, 3, null, 4, 5, null, 6, 7, 8, 9, new StdClass];

        $filter = new OneOfFilter([
            new ChainableFilter([
                new NumericFilter(),
                new EvenNumberFilter,
            ]),
            new ObjectFilter()
        ], $nonFiltered);

        dd($filter->toArray());

^ array:5 [▼
  0 => 2
  1 => 4
  2 => 6
  3 => 8
  4 => {#356}
]
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance49

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

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

378d ago

### Community

Maintainers

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

---

Top Contributors

[![Shelamkoff](https://avatars.githubusercontent.com/u/20490712?v=4)](https://github.com/Shelamkoff "Shelamkoff (16 commits)")

### Embed Badge

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

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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