PHPackages                             zihad/pilter - 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. zihad/pilter

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

zihad/pilter
============

A filter package to help developers to attach filter queries to their query builder.

0.2.0(2mo ago)01.3kMITPHPPHP ^8.2

Since Oct 4Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/muhammadZihad/pilter)[ Packagist](https://packagist.org/packages/zihad/pilter)[ RSS](/packages/zihad-pilter/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (21)Versions (5)Used By (0)

Pilter
======

[](#pilter)

Pilter is a Laravel package designed to simplify and organize filter and sorting queries in your Laravel applications. By separating these operations into dedicated classes, Pilter helps make your code cleaner, more readable, and easier to maintain.

Installation
============

[](#installation)

You can install the package via Composer:

```
composer require zihad/pilter
```

Usage/Examples
--------------

[](#usageexamples)

Create a new `Filter` class `PostFilter`

`php artisan make:filter Post`

```
namespace App\Filters;

use Zihad\Pilter\Filters\Filter;

class PostFilter extends Filter
{
    //
}
```

You can use the Filter class like this:

```
$posts = (new PostFilter(Post::query(), ['title' => 'Post 1', 'sort' => '-title']))
    ->filter()
    ->sort()
    ->get();
```

Or

```
namespace App\Models;

use Zihad\Pilter\Traits\Filterable;

// Use Filterable trait in model
class Post extends Model
{
    use Filterable;
}

$posts = Post::query()
    ->applyQuery(['title' => 'Post 1', 'sort' => '-title']), PostFilter::class)
    ->get();
```

You can filter and sort by defining separate methods in `PostFilter.php`

```
// Filter method
protected function title($title)
{
    $this->getQuery()->where('title', $title);
}
// Sort method
protected function sortTitle($order)
{
    $this->getQuery()->orderBy('title', $order);
}
```

Or you can do the basic filters and sorting by adding then in filterable and sortable attributes in `PostFilter.php`

```
protected array $filterableFields = ['title', 'category', 'slug'];
protected array $sortableFields = ['title', 'category', 'slug'];
```

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance83

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

Total

4

Last Release

85d ago

PHP version history (2 changes)0.1.0PHP ^8.0

0.2.0.x-devPHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/48516246?v=4)[Muhammad AR Zihad](/maintainers/muhammadZihad)[@muhammadZihad](https://github.com/muhammadZihad)

---

Top Contributors

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

###  Code Quality

TestsPest

Static AnalysisPHPStan

### Embed Badge

![Health badge](/badges/zihad-pilter/health.svg)

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

###  Alternatives

[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.7M223](/packages/backpack-crud)[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3416.6k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

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