PHPackages                             marcoskubis/resource-filtering - 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. marcoskubis/resource-filtering

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

marcoskubis/resource-filtering
==============================

Laravel resource filtering for Eloquent Models

v1.0.1(7y ago)021MITPHP

Since Jul 5Pushed 7y ago1 watchersCompare

[ Source](https://github.com/marcoskubis/resource-filtering)[ Packagist](https://packagist.org/packages/marcoskubis/resource-filtering)[ RSS](/packages/marcoskubis-resource-filtering/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

Laravel resource filtering for Eloquent models
==============================================

[](#laravel-resource-filtering-for-eloquent-models)

- For search by term, you must use Laravel Scout

Instalation
-----------

[](#instalation)

`composer require marcoskubis/resource-filtering`

How to use
----------

[](#how-to-use)

Your model: Product.php

```
use Illuminate\Database\Eloquent\Model;

class Product extends Model {}

```

ProductSearch.php

```
use Kubis\Filtering\Searchable;

class ProductSearch extends Searchable
{
    /**
     * Get the model for filtering
     * @return String
     */
    protected function getModel(): String
    {
        return Product::class;
    }

    /**
     * Get the default field filters. Must be a field name in your database.
     * @return Array
     */
    protected function getFilters(): Array
    {
        return ['name'];
    }

    /**
     * Get date fields. Is use for filter between dates.
     * @return Array
     */
    protected function getDates(): Array
    {
        return [
            'created_at',
            'updated_at',
        ];
    }

    /**
     * Optional, but very useful: Add custom filter. See below the example with 'my_custom_filter'.
     * @return Builder
     */
    function getMyCustomFilterFilter ($builder, $value) {
        return $builder->where('something', $value);
    }
}

```

#### Examples

[](#examples)

```
// To get all records
ProductSearch::make()->get();

// To paginate
ProductSearch::make()->paginate();

// To filter by field
ProductSearch::make()->filter(['name' => "My Product Name"])->get();
ProductSearch::make()->filter(['category_id' => 1)->get();
ProductSearch::make()->filter(['category_id' => 1)->paginate();

// Filter by a custom filter
ProductSearch::make()->filter(['my_custom_filter' => 'some value')->paginate();

// To sort by field
ProductSearch::make()->sorting(['name' => 'desc'])->get();

// To sort by a related field
ProductSearch::make()->sorting(['category.name' => 'desc'])->get();

// To serach by a term. Requires Laravel Scout
ProductSearch::make()->term("My search term")->get();

```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Total

2

Last Release

2917d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3844716?v=4)[Marcos Kubis](/maintainers/marcoskubis)[@marcoskubis](https://github.com/marcoskubis)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/marcoskubis-resource-filtering/health.svg)

```
[![Health](https://phpackages.com/badges/marcoskubis-resource-filtering/health.svg)](https://phpackages.com/packages/marcoskubis-resource-filtering)
```

###  Alternatives

[flarum/core

Delightfully simple forum software.

201.4M2.2k](/packages/flarum-core)[alajusticia/laravel-expirable

Make Eloquent models expirable

21102.6k6](/packages/alajusticia-laravel-expirable)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2013.2k](/packages/alajusticia-laravel-logins)[outerweb/image-library

Store and link files to your models

1113.8k3](/packages/outerweb-image-library)

PHPackages © 2026

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