PHPackages                             lostinvlg/filter-collection - 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. lostinvlg/filter-collection

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

lostinvlg/filter-collection
===========================

v1.0.6(2y ago)015MITPHPPHP ^8.2

Since Jan 16Pushed 2y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (3)Versions (8)Used By (0)

Filter Collection
=================

[](#filter-collection)

Usage
-----

[](#usage)

```
$bag = new FilterBag();
$bag
    ->add(new Filter(FilterType::RANGE, 'price', 'Price', '', 'rub.', [
        new FilterValue(1000, null),
        new FilterValue(2999, null),
    ]))
    ->add(new Filter(FilterType::BOOLEAN, 'in-stock', 'Only available', '', '', [
        new FilterValue(1, 'Yes'),
        new FilterValue(0, 'No'),
    ]))
    ->add(new Filter(FilterType::SINGLE, 'brand', 'Manufacturer', '', '', [
        new FilterValue(10, 'LG'),
        new FilterValue(20, 'Samsung'),
        new FilterValue(30, 'Toshiba'),
    ]))
    ->add(new Filter(FilterType::MULTI, 'model', 'Model', '', '', [
        new FilterValue(110, 'LG Model-1'),
        new FilterValue(120, 'LG Model-2'),
        new FilterValue(112, 'Samsung Super Model'),
        new FilterValue(113, 'Toshiba Old Model'),
    ]))
    ->add(new Filter(FilterType::COLOR, 'color', 'Model', '', '', [
        new FilterValue(25, 'White'),
        new FilterValue(26, 'Black'),
        new FilterValue(26, 'Gray'),
    ]));

$filterCollection = new FilterCollection($bag);
$query = $request->query->all(); // $_GET
$filterCollection->parse($query);
$allFilters = $filterCollection->getFilters();
$validFilters = $filterCollection->getValidFilters();
```

Valid query string:

```
price=1000;2000&in-stock=1&brand=20&model=110,120,&color=25,26

```

Range query string can contain zeros:

```
price=1000   // from 1000
price=0;2000 // from 0 to 2000
price=;2000  // from 0 to 2000
price=1000;0 // from 1000

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Every ~4 days

Total

7

Last Release

820d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6015d4a22edf4ec362b85d8b362081f58fec399ed9deb172e6e0f7935245b0ff?d=identicon)[lostinvlg](/maintainers/lostinvlg)

---

Top Contributors

[![lostinvlg](https://avatars.githubusercontent.com/u/13403087?v=4)](https://github.com/lostinvlg "lostinvlg (14 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  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)[nette/forms

📝 Nette Forms: generating, validating and processing secure forms in PHP. Handy API, fully customizable, server &amp; client side validation and mature design.

54013.2M448](/packages/nette-forms)[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)

PHPackages © 2026

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