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

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

particle/filter
===============

Flexible and highly usable filter library with no dependencies.

v1.5.2(6y ago)83702.1k↓42.4%11[3 issues](https://github.com/particle-php/Filter/issues)[5 PRs](https://github.com/particle-php/Filter/pulls)5BSD-3-ClausePHPPHP &gt;=5.4CI failing

Since May 28Pushed 4y ago5 watchersCompare

[ Source](https://github.com/particle-php/Filter)[ Packagist](https://packagist.org/packages/particle/filter)[ Docs](http://github.com/particle-php/Filter)[ RSS](/packages/particle-filter/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (2)Versions (19)Used By (5)

[![Particle\Filter](https://cloud.githubusercontent.com/assets/6495166/7777918/406635e8-00c7-11e5-90e3-96c590828ffd.png)](https://cloud.githubusercontent.com/assets/6495166/7777918/406635e8-00c7-11e5-90e3-96c590828ffd.png)
==============================================================================================================================================================================================================================

[](#)

[![Travis-CI](https://camo.githubusercontent.com/12fbe3eba9fcb4b0ca34ac6cf93a1aa4143cbd5a5477db4912aff34d1a7008b9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7061727469636c652d7068702f46696c7465722f6d61737465722e737667)](https://travis-ci.org/particle-php/Filter)[![Packagist](https://camo.githubusercontent.com/e8d33bf7aef0634fef2651b42cc35585653f0980671006a08c6b076b85326973/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7061727469636c652f66696c7465722e737667)](https://packagist.org/packages/particle/filter)[![Packagist downloads](https://camo.githubusercontent.com/a2a8acca647dbba3eccf2b7c171cee0276553675dd42c7264b1d52b80e8692c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7061727469636c652f66696c7465722e737667)](https://packagist.org/packages/particle/filter)[![Scrutinizer](https://camo.githubusercontent.com/0548a361fc03f096b1f110986898d3b50aea450648a91a2ecab605301dd349ea/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7061727469636c652d7068702f46696c7465722e737667)](https://scrutinizer-ci.com/g/particle-php/Filter/?branch=master)[![Scrutinizer](https://camo.githubusercontent.com/ccfa8cbe78bcc6051df6ff01f031d96713c760a363feac7e755537d2dddd05b7/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7061727469636c652d7068702f46696c7465722f6d61737465722e737667)](https://scrutinizer-ci.com/g/particle-php/Filter/?branch=master)

*Particle\\Filter* is a very small filtering library, with the easiest and most usable API we could possibly create.

Small usage example
-------------------

[](#small-usage-example)

```
$f = new Particle\Filter\Filter;

$f->values(['user.first_name', 'user.last_name'])->trim()->lower()->upperFirst();
$f->value('newsletter')->bool();
$f->value('created_at')->defaults(date('Y-m-d'));
$f->all()->removeNull();

$result = $f->filter([
    'user' => [
        'first_name' => '  JOHN ',
        'middle_name' => null,
        'last_name' => ' DOE  ',
    ],
    'newsletter' => 'yes',
    'referral' => null,
]);

var_dump($result);
/**
 * array(3) {
 *     ["user"]=> array(2) {
 *         ["first_name"]=> string(4) "John"
 *         ["last_name"]=> string(3) "Doe"
 *     }
 *     ["newsletter"]=> bool(true)
 *     ["created_at"]=> string(10) "2015-12-10"
 * }
 */
```

Functional features
-------------------

[](#functional-features)

- Filter an array of values
- Get a cleaned array after filtering
- [A large set of available filters](http://filter.particle-php.com/en/latest/filter-rules/)
- Ability to set default values if nothing is provided
- Ability to filter nested, repeated arrays
- Ability to remove (empty) values
- Ability to extend the filter to add your own custom filter rules

Non functional features
-----------------------

[](#non-functional-features)

- Easy to write (IDE auto-completion for easy development)
- Easy to read (improves peer review)
- Fully documented: [filter.particle-php.com](http://filter.particle-php.com)
- Fully tested: [Scrutinizer](https://scrutinizer-ci.com/g/particle-php/Filter/?branch=master)
- Zero dependencies

===

Find more information and advanced usage examples at [filter.particle-php.com](http://filter.particle-php.com)

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity52

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~284 days

Total

17

Last Release

2509d ago

Major Versions

v0.6.0 → v1.0.02015-06-26

PHP version history (2 changes)v0.1.0PHP &gt;=5.3.2

v0.3.0PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/6169c8b4657a79f3a96b4f167abc794d76402db6e4c0ad4bfe0c9b71fa8b2ef1?d=identicon)[berry\_\_](/maintainers/berry__)

![](https://www.gravatar.com/avatar/8517df511923178ac5c36f913626d23a678563d2af6219bd77c46f3b5466c794?d=identicon)[RickvdStaaij](/maintainers/RickvdStaaij)

---

Top Contributors

[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (12 commits)")[![skoop](https://avatars.githubusercontent.com/u/90003?v=4)](https://github.com/skoop "skoop (11 commits)")[![renatomefi](https://avatars.githubusercontent.com/u/823634?v=4)](https://github.com/renatomefi "renatomefi (6 commits)")[![jhuet](https://avatars.githubusercontent.com/u/372409?v=4)](https://github.com/jhuet "jhuet (5 commits)")[![berry-langerak](https://avatars.githubusercontent.com/u/203825?v=4)](https://github.com/berry-langerak "berry-langerak (3 commits)")[![Finesse](https://avatars.githubusercontent.com/u/9006227?v=4)](https://github.com/Finesse "Finesse (1 commits)")[![rick-nu](https://avatars.githubusercontent.com/u/6495166?v=4)](https://github.com/rick-nu "rick-nu (1 commits)")[![albertcansado](https://avatars.githubusercontent.com/u/4248492?v=4)](https://github.com/albertcansado "albertcansado (1 commits)")

---

Tags

filterfiltering

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[clue/stream-filter

A simple and modern approach to stream filtering in PHP

1.7k276.5M9](/packages/clue-stream-filter)[laminas/laminas-filter

Programmatically filter and normalize data and files

9530.3M181](/packages/laminas-laminas-filter)[htmlawed/htmlawed

Official htmLawed PHP library for HTML filtering

481.2M15](/packages/htmlawed-htmlawed)[bukashk0zzz/filter-bundle

Symfony filter bundle.

24459.9k1](/packages/bukashk0zzz-filter-bundle)[messere/php-value-mask

extract subset of array / object values

1147.4k1](/packages/messere-php-value-mask)[kalfheim/sanitizer

Data sanitizer for PHP with built-in Laravel support.

1523.8k](/packages/kalfheim-sanitizer)

PHPackages © 2026

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