PHPackages                             mannysoft/hanap - 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. mannysoft/hanap

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

mannysoft/hanap
===============

Laravel package API Result filtering, sorting &amp; searching.

02841PHP

Since Sep 13Pushed 7y ago1 watchersCompare

[ Source](https://github.com/mannysoft/hanap)[ Packagist](https://packagist.org/packages/mannysoft/hanap)[ RSS](/packages/mannysoft-hanap/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

hanap
=====

[](#hanap)

Laravel package API Result filtering, sorting &amp; searching.

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

[](#installation)

Require this package with composer.

```
composer require mannysoft/hanap
```

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

Usage
-----

[](#usage)

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

use Mannysoft\Hanap\FilterTrait;
use Mannysoft\Hanap\FilterScope;

class Team extends Model
{
    use FilterTrait;

    protected $fillable = ['name'];

    protected $filters = ['status']; // field to filter ?status=active

    protected $sorts = ['name', 'status']; // fields to ?sort=name ?sort=-name ?sort=name,-status

    protected $searchableColumns = ['name']; // fields to search

    /**
     * The "booting" method of the model.
     *
     * @return void
     */
    protected static function boot()
    {
        parent::boot();

        static::addGlobalScope(new FilterScope);
    }
}
```

Now you can use in your model.

```
// Will automatically run the filters, sorts and search
$teams = Team::all();
```

```
GET /teams?status=active // Get active teams
GET /teams?sort=-name,created_at // Retrieves a list of teams in descending order of name. Within a specific name, older teams are ordered first
GET /teams?q=manny // Retrieves data mentioning the word 'manny'
GET /teams?fields=id,name // Retrieves fields 'id' and 'name'
```

```
namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\Resource;

class TeamResource extends Resource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return show_fields([
            'id' => $this->id,
            'name' => $this->name,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ]);
    }
}
```

```
{
    "data": [
        {
            "id": 1,
            "name": "Dream Team"
        },
        {
            "id": 2,
            "name": "Team 1"
        }
    ]
}
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e7052870acdc2ec859177432893616bfdc226fa96009f1773269140ca9a5aa1?d=identicon)[mannysoft](/maintainers/mannysoft)

---

Top Contributors

[![mannysoft](https://avatars.githubusercontent.com/u/774913?v=4)](https://github.com/mannysoft "mannysoft (30 commits)")

### Embed Badge

![Health badge](/badges/mannysoft-hanap/health.svg)

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

###  Alternatives

[awesome-nova/dependent-filter

Dependent filters for Laravel Nova

26190.2k](/packages/awesome-nova-dependent-filter)[algolia/php-dom-parser

A simple tool to turn DOM into Algolia search friendly record objects.

181.8k](/packages/algolia-php-dom-parser)

PHPackages © 2026

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