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

6.1.0(2mo ago)015.6k↓47.2%MITPHPPHP ^8.2

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

READMEChangelog (10)Dependencies (16)Versions (43)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

54

—

FairBetter than 97% of packages

Maintenance85

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity80

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

Total

42

Last Release

60d 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 (42 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

[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[specialtactics/l5-api

Dependencies for the Laravel API Boilerplate package

3672.8k2](/packages/specialtactics-l5-api)[bmatovu/laravel-mtn-momo

Laravel MTN MOMO integration.

14310.9k](/packages/bmatovu-laravel-mtn-momo)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)

PHPackages © 2026

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