PHPackages                             karabinse/eloquent-searchable - 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. karabinse/eloquent-searchable

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

karabinse/eloquent-searchable
=============================

Easily search eloquent models and their relations

1.4.3(4mo ago)26.9k↑166.7%MITPHPPHP ^8.2CI passing

Since May 8Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/KarabinSE/eloquent-searchable)[ Packagist](https://packagist.org/packages/karabinse/eloquent-searchable)[ Docs](https://github.com/karabinse/eloquent-searchable)[ GitHub Sponsors](https://github.com/Karabin)[ RSS](/packages/karabinse-eloquent-searchable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (11)Used By (0)

Easily search eloquent models and their relations
=================================================

[](#easily-search-eloquent-models-and-their-relations)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b98e6296ff014a6473898e1e3ef69e6166e3f7997f30fff9c9c463db189d85cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b61726162696e73652f656c6f7175656e742d73656172636861626c652e737667)](https://packagist.org/packages/karabinse/eloquent-searchable)[![GitHub Tests Action Status](https://camo.githubusercontent.com/eef96f95d3f64f977f182a6c6b5b393629a875517ad4125fadfd7e27d945c8ac/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6b61726162696e73652f656c6f7175656e742d73656172636861626c652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473)](https://github.com/karabinse/eloquent-searchable/actions?query=workflow%3Arun-tests+branch%3Amain)

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

[](#installation)

You can install the package via composer:

```
composer require karabinse/eloquent-searchable
```

Usage
-----

[](#usage)

Add the trait and add columns that are searchable.

```
use Karabin\Searchable\Concerns\IsSearchable;

class User extends Authenticatable
{
    use HasFactory, HasRoles, IsSearchable, Notifiable;

    protected $searchable = [
        'name',
        'email',
        'posts.title'
    ];
```

The package also includes a custom TermSearchFitler to be used with [Laravel Query Builder](https://github.com/spatie/laravel-query-builder).

```
use Karabin\Searchable\Filters\TermSearchFilter;

class UserController extends Controller
{
    public function index(Request $request)
    {
        $users = QueryBuilder::for(User::class)
            ->allowedFilters([
                AllowedFilter::custom('search', new TermSearchFilter),
            ])
            ->paginate($request->query('limit', 10));

        return Inertia::render('User/Index', [
            'users' => UserData::collect($users),
        ]);
    }
```

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Albin N](https://github.com/nivv)
- [Daniel K Modig](https://github.com/dnkmdg)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance77

Regular maintenance activity

Popularity27

Limited adoption so far

Community8

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

Recently: every ~75 days

Total

10

Last Release

125d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/53842b68734249d1bd4581663ce93e12dd241047cbdc11c49065f294c0228d36?d=identicon)[Albin N](/maintainers/Albin%20N)

---

Top Contributors

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

---

Tags

laravelKarabineloquent-searchable

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/karabinse-eloquent-searchable/health.svg)

```
[![Health](https://phpackages.com/badges/karabinse-eloquent-searchable/health.svg)](https://phpackages.com/packages/karabinse-eloquent-searchable)
```

###  Alternatives

[spatie/laravel-site-search

A site search engine

300129.1k](/packages/spatie-laravel-site-search)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[omaressaouaf/query-builder-criteria

Define reusable query criteria for filtering, sorting, search, field selection, and includes in Laravel Eloquent models

282.4k](/packages/omaressaouaf-query-builder-criteria)[codewithdennis/filament-price-filter

A simple and customizable price filter for FilamentPHP, allowing users to easily refine results based on specified price ranges.

163.2k](/packages/codewithdennis-filament-price-filter)[eightynine/filament-docs

Elegant documentation system for your Filament application with search, navigation, and markdown support

122.5k1](/packages/eightynine-filament-docs)

PHPackages © 2026

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