PHPackages                             tes/laravel-relafilter - 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. tes/laravel-relafilter

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

tes/laravel-relafilter
======================

A lightweight Laravel package to filter model data through nested relationships using a simple input structure.

v1.0.0(11mo ago)01MITPHPPHP ^8.0

Since Jul 23Pushed 11mo agoCompare

[ Source](https://github.com/Thomas-Emad/laravel-relafilter)[ Packagist](https://packagist.org/packages/tes/laravel-relafilter)[ RSS](/packages/tes-laravel-relafilter/feed)WikiDiscussions main Synced today

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

Laravel Relafilter
==================

[](#laravel-relafilter)

**Laravel Relafilter** is a lightweight and expressive filtering package for Laravel models. It allows you to filter using deeply nested relationships without writing complex query logic.

> ⚠️ This package is **not a replacement** for Laravel's Query Builder. Instead, it's a **lightweight and simpler alternative** for specific use cases — especially useful in Livewire components or API filters.

---

🚀 Installation
--------------

[](#-installation)

```
composer require tes/laravel-relafilter
```

---

✅ Key Features
--------------

[](#-key-features)

- Simple syntax using array-based filters
- Supports nested relationships (`employee.current_company.position.name`)
- Supports common query operators like `=`, `like`, `>`, `
```

```
use App\Models\Employee;

class EmployeeList extends Component
{
    public array $search = [];

    public function render()
    {
        $employees = Employee::filter($this->search)->get();

        return view('livewire.employee-list', compact('employees'));
    }
}
```

### 🟡 In Controller

[](#-in-controller)

```
use App\Models\Employee;
use Illuminate\Http\Request;

public function index(Request $request)
{
    $employees = Employee::filter($request->input())->get();

    return view('employees.index', compact('employees'));
}
```

```

```

---

🔍 Supported Operators
---------------------

[](#-supported-operators)

SyntaxSQL EquivalentExample`:like``LIKE``name:like => John``:=``=``status:= => active``:!=``!=``type:!= => admin``:>``>``age:> => 30``:whereBetween('start_date', [
        $flatFilters['start'],
        Carbon::parse($flatFilters['end'])->endOfDay(),
    ]);
}
```

### ✨ Example Filter Input (Array)

[](#-example-filter-input-array)

```
[
    'company.name:like' => 'Tesla',
    'current_company_position.position.name:like' => 'Developer',
    'status' => 'active',
    'created_at:>' => '2024-01-01',
    'start' => '2024-06-01',
    'end' => '2024-06-30',
]
```

---

🧩 Integration
-------------

[](#-integration)

Make sure your model uses the `HasRelafilter` trait:

```
use Tes\LaravelRelafilter\Traits\HasRelafilter;

class Employee extends Model
{
    use HasRelafilter;
}
```

---

📦 Package Status
----------------

[](#-package-status)

This package is still in early development. Please report any issues or suggestions via GitHub.

---

📄 License
---------

[](#-license)

This package is open-source software licensed under the [MIT license](LICENSE).

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance51

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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

Unknown

Total

1

Last Release

347d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5fd781b0c5e39d4ab6f530d21891e0f24c977b4042fc89f0bb3e1495af9f913?d=identicon)[thomas-emad](/maintainers/thomas-emad)

---

Top Contributors

[![Thomas-Emad](https://avatars.githubusercontent.com/u/54818496?v=4)](https://github.com/Thomas-Emad "Thomas-Emad (1 commits)")[![thomas-emad-smarttel](https://avatars.githubusercontent.com/u/203507999?v=4)](https://github.com/thomas-emad-smarttel "thomas-emad-smarttel (1 commits)")

### Embed Badge

![Health badge](/badges/tes-laravel-relafilter/health.svg)

```
[![Health](https://phpackages.com/badges/tes-laravel-relafilter/health.svg)](https://phpackages.com/packages/tes-laravel-relafilter)
```

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M307](/packages/laravel-horizon)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k9.0M69](/packages/spatie-laravel-responsecache)

PHPackages © 2026

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