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.1.1(1y ago)0711MITPHPPHP ^8.0

Since Oct 4Pushed 12mo ago1 watchersCompare

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

READMEChangelog (2)Dependencies (11)Versions (3)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

29

—

LowBetter than 59% of packages

Maintenance49

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

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

Total

2

Last Release

371d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/92dbbe5f72d83b730f25172eb74d25b2f317ec63331561b3cc069fe21af53dc8?d=identicon)[muhammadZihad](/maintainers/muhammadZihad)

---

Top Contributors

[![muhammadZihad](https://avatars.githubusercontent.com/u/48516246?v=4)](https://github.com/muhammadZihad "muhammadZihad (8 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

[mehradsadeghi/laravel-filter-querystring

Filter your queries based on url query string parameters like a breeze.

169118.2k](/packages/mehradsadeghi-laravel-filter-querystring)[pos-lifestyle/laravel-nova-date-range-filter

A Laravel Nova date range filter.

16179.1k](/packages/pos-lifestyle-laravel-nova-date-range-filter)[omure/scout-advanced-meilisearch

Laravel Scout extension that allows to use meilisearch advanced features as well as has an extended collection driver for testing purposes.

123.9k](/packages/omure-scout-advanced-meilisearch)

PHPackages © 2026

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