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(1mo ago)016.3k↓84.6%MITPHPPHP ^8.2

Since May 8Pushed 1mo 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 3w 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

55

—

FairBetter than 97% of packages

Maintenance90

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity82

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

51d 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

[laravel/cashier

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

2.6k31.8M162](/packages/laravel-cashier)[statamic/cms

The Statamic CMS Core Package

4.9k3.8M1.2k](/packages/statamic-cms)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/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.

5226.7k](/packages/simplestats-io-laravel-client)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)

PHPackages © 2026

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