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.

0482PHP

Since May 23Pushed 2y ago1 watchersCompare

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

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

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

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://www.gravatar.com/avatar/f8a9fdcc6284e9ab3d88aadf875e121bd9770e21e3f40c1c3f1f2ae39082e9ce?d=identicon)[mohammadahmadifar](/maintainers/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

[ruflin/elastica

Elasticsearch Client

2.3k50.4M203](/packages/ruflin-elastica)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M65](/packages/opensearch-project-opensearch-php)[mailerlite/laravel-elasticsearch

An easy way to use the official PHP ElasticSearch client in your Laravel applications.

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[massive/search-bundle

Massive Search Bundle

721.4M13](/packages/massive-search-bundle)[shyim/opensearch-php-dsl

OpenSearch/Elasticsearch DSL library

175.9M9](/packages/shyim-opensearch-php-dsl)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)

PHPackages © 2026

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