PHPackages                             apichef/laravel-request-query-helper - 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. apichef/laravel-request-query-helper

ActiveLibrary[API Development](/categories/api)

apichef/laravel-request-query-helper
====================================

Easily interact with JSON-API query params.

v2.2.1(5y ago)02191MITPHPPHP ~7.4 || ^8.0CI failing

Since Feb 16Pushed 5y ago1 watchersCompare

[ Source](https://github.com/apichef/laravel-request-query-helper)[ Packagist](https://packagist.org/packages/apichef/laravel-request-query-helper)[ Docs](https://github.com/apichef/laravel-request-query-helper)[ RSS](/packages/apichef-laravel-request-query-helper/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (5)Versions (16)Used By (1)

laravel-json-api-query-params
=============================

[](#laravel-json-api-query-params)

[![Latest Version on Packagist](https://camo.githubusercontent.com/59179c7a14ecb7890c0027a0918fc1ea85f9dc7583f79f589a8ef1d83d301993/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617069636865662f6c61726176656c2d726571756573742d71756572792d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/apichef/laravel-request-query-helper)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://github.com/apichef/laravel-request-query-helper/workflows/CI/badge.svg)](https://github.com/apichef/laravel-request-query-helper/actions)[![Coverage Status](https://camo.githubusercontent.com/240377f89155d658d59e21c102aadbf4761e84a597de57f49b42e0240a37ebb9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f617069636865662f6c61726176656c2d726571756573742d71756572792d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/apichef/laravel-request-query-helper/code-structure)[![Quality Score](https://camo.githubusercontent.com/3f593b0b9881bb04d0f9f6ef483561c227d1869d8185e192946fa0e35f05a80a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f617069636865662f6c61726176656c2d726571756573742d71756572792d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/apichef/laravel-request-query-helper)[![Total Downloads](https://camo.githubusercontent.com/b02af4ddf4ba3abb6f7350ff3236c5317f3e20e98aef39748f5892cd5c3122bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617069636865662f6c61726176656c2d726571756573742d71756572792d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/apichef/laravel-request-query-helper)

Easily interact with JSON-API query params.
===========================================

[](#easily-interact-with-json-api-query-params)

Install
-------

[](#install)

Via Composer

```
$ composer require apichef/laravel-request-query-helper
```

You can publish the config file with:

```
$ php artisan vendor:publish --provider="ApiChef\RequestQueryHelper\RequestQueryHelperServiceProvider"
```

Usage
-----

[](#usage)

#### Configuration

[](#configuration)

Default configuration is follows the [{json:api} specification](https://jsonapi.org/format/#fetching).

```
return [
    /* Configuration for inclusion of related resources */
    'include' => [
        'name' => 'include',
    ],

    /* Configuration for filtering resource collections */
    'filter' => [
        'name' => 'filter',
    ],

    /* Configuration for sorting resource collections */
    'sort' => [
        'name' => 'sort',
    ],

    /* Configuration for sparse field-sets */
    'fields' => [
        'name' => 'fields',
    ],

    /* Configuration for pagination */
    'pagination' => [
        'name' => 'page',
        'number' => 'number',
        'size' => 'size',
    ],
];
```

Includes and Filters
--------------------

[](#includes-and-filters)

This package adds `filters` and `includes` methods to the query object. Both methods returns `QueryParamBag`, which is capable of parsing array-based and string-based request query strings.

Eg:

```
GET '/posts?include=comments:limit(5):sort(created_at|desc),author'

```

or

```
GET '/posts?include[comments][limit]=5&include[comments][sort]=created_at|desc&include[author]'

```

Following examples are based on above request.

```
use Illuminate\Http\Request;

class ExampleController extends Controller
{
    public function show(Request $request)
    {
        $params = $request->includes();

        // has

        $params->has('comments'); // true
        $params->has('comments.limit'); // true
        $params->has('comments.sort'); // true
        $params->has('comments.foo'); // false
        $params->has('author'); // true

        // get

        $params->get('comments.limit'); // [5]
        $params->get('comments.sort'); // ['created_at', 'desc']

        // isEmpty

        $params->isEmpty('comments'); // false
        $params->isEmpty('author'); // true
    }
}

## Sorts

// todo

## Fields

// todo

## Pagination

// todo
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Milroy E. Fraser](https://github.com/milroyfraser)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity69

Established project with proven stability

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

Recently: every ~0 days

Total

10

Last Release

1872d ago

Major Versions

v0.6.0 → v1.0.12021-03-27

v1.0.1 → v2.0.12021-03-28

PHP version history (3 changes)v0.0.1PHP ~7.2

0.0.4PHP ~7.2 || ^8.0

v1.0.1PHP ~7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f3ba1935044647e51c405868792beea05a76250a8f7ef408c9b706edf51fcb6?d=identicon)[milroy.me](/maintainers/milroy.me)

---

Top Contributors

[![milroyfraser](https://avatars.githubusercontent.com/u/3282475?v=4)](https://github.com/milroyfraser "milroyfraser (22 commits)")

---

Tags

MilroyFraserlaravel-json-api-query-params

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/apichef-laravel-request-query-helper/health.svg)

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

###  Alternatives

[spatie/laravel-query-builder

Easily build Eloquent queries from API requests

4.4k26.9M220](/packages/spatie-laravel-query-builder)[essa/api-tool-kit

set of tools to build an api with laravel

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

A laravel wrapper package around the Facebook Conversions API

69145.4k](/packages/esign-laravel-conversions-api)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

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