PHPackages                             laraditz/saring - 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. [Database &amp; ORM](/categories/database)
4. /
5. laraditz/saring

ActiveLaravel-package[Database &amp; ORM](/categories/database)

laraditz/saring
===============

A simple eloquent model filter.

1.0.3(4y ago)0136MITPHPPHP ^7.2.5|^8.0

Since May 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/laraditz/saring)[ Packagist](https://packagist.org/packages/laraditz/saring)[ RSS](/packages/laraditz-saring/feed)WikiDiscussions master Synced 1w ago

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

Saring
======

[](#saring)

[![Latest Stable Version](https://camo.githubusercontent.com/340c194895fb61348d91a7fdfc767063bea4f9e3dc32a5a6d2b776f65f3b2063/68747470733a2f2f706f7365722e707567782e6f72672f6c6172616469747a2f736172696e672f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/laraditz/saring)[![Total Downloads](https://camo.githubusercontent.com/d32d020fd43e425f2c4446978a341636c0e88d44b090b780b2734035d6cfff94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6172616469747a2f736172696e673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laraditz/saring)[![License](https://camo.githubusercontent.com/2f2b7e53ccaa81488e2a660671bb957fb07d5aa17679f51fc166e780b8a85139/68747470733a2f2f706f7365722e707567782e6f72672f6c6172616469747a2f736172696e672f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/laraditz/saring)[![StyleCI](https://camo.githubusercontent.com/3ebb9759d3748ad0fa1b6c7f477c842a04b4bdc799f75a8b68f3c6d585d07be8/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f373534383938362f736869656c643f7374796c653d737175617265)](https://github.com/laraditz/saring)

A simple eloquent model filter for Laravel and Lumen.

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

[](#installation)

Via Composer

```
$ composer require laraditz/saring
```

Configuration
-------------

[](#configuration)

Add filterable trait to your model as below snippet:

```
use Laraditz\Saring\Filterable;

class User extends Model implements AuthenticatableContract, AuthorizableContract
{
    use Filterable;
    ...
}
```

Create filter class under the `App/Filters` folder with `Filter` format. For example for `User` model, you will need to create `UserFilter` class.

Below snippet shows how the `UserFilter` could look like:

```
namespace App\Filters;

use Laraditz\Saring\Filter;

class UserFilter extends Filter
{
    public function name($value)
    {
        $this->where('name', 'LIKE', $value);
    }

    public function email($value)
    {
        $this->where('email', 'LIKE', "%$value%");
    }
}
```

If you want to have more control on which attributes can be filtered, you can add `filterable` array to you model:

```
protected $filterable = [
    'name', 'email'
];
```

Usage
-----

[](#usage)

In your controller, call `filter` method and pass the input data to use the filter that you have created.

```
$users = User::filter($request->all())->get();
```

That's it!

Credits
-------

[](#credits)

- [Raditz Farhan](https://github.com/raditzfarhan)

License
-------

[](#license)

MIT. Please see the [license file](LICENSE) for more information.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 54.5% 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 ~206 days

Total

4

Last Release

1580d ago

PHP version history (2 changes)1.0.0PHP ^7.2.5

1.0.3PHP ^7.2.5|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1203676?v=4)[Raditz Farhan](/maintainers/raditzfarhan)[@raditzfarhan](https://github.com/raditzfarhan)

---

Top Contributors

[![raditzfarhan](https://avatars.githubusercontent.com/u/1203676?v=4)](https://github.com/raditzfarhan "raditzfarhan (12 commits)")[![farhan928](https://avatars.githubusercontent.com/u/8623033?v=4)](https://github.com/farhan928 "farhan928 (10 commits)")

---

Tags

laravellumenmodeleloquentfilter

### Embed Badge

![Health badge](/badges/laraditz-saring/health.svg)

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

###  Alternatives

[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[spiritix/lada-cache

A Redis based, automated and scalable database caching layer for Laravel

591444.8k2](/packages/spiritix-lada-cache)[mohammad-fouladgar/eloquent-builder

527189.5k](/packages/mohammad-fouladgar-eloquent-builder)[mehdi-fathi/eloquent-filter

Eloquent Filter adds custom filters automatically to your Eloquent Models in Laravel.It's easy to use and fully dynamic, just with sending the Query Strings to it.

450191.6k1](/packages/mehdi-fathi-eloquent-filter)

PHPackages © 2026

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