PHPackages                             mohammadahmadifar/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. mohammadahmadifar/filters

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

mohammadahmadifar/filters
=========================

This package helps you to create custom search on index method of controllers easily.

0483PHP

Since May 23Pushed 3y ago1 watchersCompare

[ Source](https://github.com/mohammadahmadifar/filters)[ Packagist](https://packagist.org/packages/mohammadahmadifar/filters)[ RSS](/packages/mohammadahmadifar-filters/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Filters
=======

[](#filters)

This package helps you to create custom search on index method of controllers easily.

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

[](#installation)

Use the package manager [composer](https://getcomposer.org) to install this package.

```
composer require mohammadahmadifar/filters:dev-main
```

Usage
-----

[](#usage)

Each model should extend from BaseModel. Then create a filter class extended from Filters, the class should contain these parameters like this :

```
    /**
     * Registered filters to operate upon.
     *
     * @var array
     */
    protected array $filters = [
        'ids',
        ...
    ];

    /**
     * Define type of variables.
     *
     * @var array
     */
    public array $attributes = [
        'ids' => 'array',
        ...
    ];

    /**
     * @param string $email Email.
     *
     * @return Builder
     */
    protected function ids(array $ids) {
        return $this->builder->whereIn('id', $ids);
    }
```

Then in index method of controller you can do like this :

```
    /**
     * Display a listing of the resource.
     *
     * @param UserFilter $filters UserFilter.
     * @param Request    $request Request.
     *
     * @return AnonymousResourceCollection
     */
    public function index(UserFilter $filters, Request $request): AnonymousResourceCollection
    {
        return UserResource::collection(User::filter($filters));
    }
```

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

16

—

LowBetter than 4% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/101142018?v=4)[mohammad ahmadifar](/maintainers/mohammadahmadifar)[@mohammadahmadifar](https://github.com/mohammadahmadifar)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[awesome-nova/dependent-filter

Dependent filters for Laravel Nova

26193.1k](/packages/awesome-nova-dependent-filter)[antsfree/mxusearch

this is mxu fulltext search application.

414.0k](/packages/antsfree-mxusearch)[algolia/php-dom-parser

A simple tool to turn DOM into Algolia search friendly record objects.

181.8k](/packages/algolia-php-dom-parser)

PHPackages © 2026

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