PHPackages                             waxwink/search-repository - 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. waxwink/search-repository

ActiveLibrary

waxwink/search-repository
=========================

An abstraction repository class for laravel which handles the filtering and searching through a table

0.9.12(6y ago)09MITPHP

Since Nov 27Pushed 6y ago1 watchersCompare

[ Source](https://github.com/waxwink/search-repository)[ Packagist](https://packagist.org/packages/waxwink/search-repository)[ RSS](/packages/waxwink-search-repository/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (4)Used By (0)

search-repository
=================

[](#search-repository)

Instruction
-----------

[](#instruction)

create a specific repository for your model (e.g User) and extend the SearchRepository. In your class you should define your filterable and searchable attributes and you are ready to go.

```
use Waxwink\SearchRepository\SearchRepository;

class UserSearchRepository extends SearchRepository
{

    protected $searchable_attributes = [
        'name',
        'last_name',
        'cellphone',
    ];

    protected $filterable_attributes = [
        'birth_date',
        'gender',
        'name',
        'last_name',
        'cellphone',
        'email',
        'created_at'
    ];

    public function __construct()
    {
        $this->query = App\User::query();
    }
}
```

After creating the search repository class it can be used in your controller as follows while using the `SearchTrait`:

```
use Waxwink\SearchRepository\Concerns\SearchTrait;
use Illuminate\Http\Request;

class UserController {
    use SearchTrait;

    public function index(Request $request, UserSearchRepository $userSearchRepository)
    {
        $users = $this->filterAndSearch($request, $userSearchRepository)->paginate();

        // ...
    }
}
```

Request Body
------------

[](#request-body)

The request body should contain the fields that are going to be filtered like the following:

```
{
    "gender":["m"],
    "created_at":"2019-01-01",
    "birth_date":["1999-01-01", ">"],
    "name":["joe", "like"]
}
```

Search Param
------------

[](#search-param)

Search param should contain the searching key words like:

```
app/users?search=jack

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Total

3

Last Release

2353d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/691322b900db6b86519a6d891a39ea59824fc8cb95330303933c81be13a8dbb2?d=identicon)[mohamadreza89](/maintainers/mohamadreza89)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/waxwink-search-repository/health.svg)

```
[![Health](https://phpackages.com/badges/waxwink-search-repository/health.svg)](https://phpackages.com/packages/waxwink-search-repository)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

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