PHPackages                             jwohlfert23/laravel-api-query - 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. [API Development](/categories/api)
4. /
5. jwohlfert23/laravel-api-query

ActiveLibrary[API Development](/categories/api)

jwohlfert23/laravel-api-query
=============================

Provides laravel scope to build query from request query params

v6.1.2(6d ago)016.1k↓83.6%MITPHPPHP ^8.2

Since May 8Pushed 6d ago1 watchersCompare

[ Source](https://github.com/jwohlfert23/laravel-api-query)[ Packagist](https://packagist.org/packages/jwohlfert23/laravel-api-query)[ RSS](/packages/jwohlfert23-laravel-api-query/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (10)Dependencies (24)Versions (45)Used By (0)

Build Eloquent Queries from Request Query Params
================================================

[](#build-eloquent-queries-from-request-query-params)

### Installation

[](#installation)

`composer require jwohlfert23/laravel-api-query`

### Usage

[](#usage)

This package is implemented as a trait, which provides the `buildFromRequest` scope.

```
use Jwohlfert23\LaravelApiQuery\BuildQueryFromRequest;

class Post {
    use BuildQueryFromRequest;
}
```

```
Post::buildFromRequest()->get();
```

#### ?sort=-id,name

[](#sort-idname)

is the same as:

```
Post::orderByDesc('id')->orderBy('name');
```

#### ?filter\[name\]=Bobby&amp;filter\[author.name\]\[contains\]=Bob

[](#filternamebobbyfilterauthornamecontainsbob)

is the same as:

```
Post::where('name', 'Bobby')->whereHas('author', function($q) {
    $q->where('name', 'like', '%Bob%');
});
```

Note: this package doesn't use "whereHas", but rather performs left joins internally. However, the results should be the same as the above code.

Filters default to using the "equal" operator. These are the operators available to use in filtering (contains is use above).

- eq (=)
- gt (&gt;)
- gte (&gt;=)
- lt (&lt;)
- lte (&lt;=)
- contains

#### ?with=author,comments

[](#withauthorcomments)

is the same as

```
Post::with('author','comments');
```

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance99

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

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

Recently: every ~34 days

Total

44

Last Release

6d ago

Major Versions

1.6.3 → 2.0.02022-02-09

2.2.1 → 3.0.02023-05-01

3.0.2 → 4.0.02024-03-19

4.0.0 → 5.0.02025-03-11

5.1.0 → 6.0.02026-02-04

PHP version history (4 changes)1.0PHP &gt;=5.5.9

2.0.0PHP &gt;=7.3

2.2.0PHP ^8.0

4.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3b9575f490d700ca84c6ffafdde7528e958b1fd37cb9900ec92128351452571?d=identicon)[jwohlfert23](/maintainers/jwohlfert23)

---

Top Contributors

[![jwohlfert23](https://avatars.githubusercontent.com/u/2797531?v=4)](https://github.com/jwohlfert23 "jwohlfert23 (46 commits)")

---

Tags

apilaravelquery

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/jwohlfert23-laravel-api-query/health.svg)

```
[![Health](https://phpackages.com/badges/jwohlfert23-laravel-api-query/health.svg)](https://phpackages.com/packages/jwohlfert23-laravel-api-query)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M1.0k](/packages/statamic-cms)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k30.1M148](/packages/laravel-cashier)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[api-platform/laravel

API Platform support for Laravel

58173.0k15](/packages/api-platform-laravel)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.2k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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