PHPackages                             ionext/laravel-api-query-parser - 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. ionext/laravel-api-query-parser

AbandonedLibrary[API Development](/categories/api)

ionext/laravel-api-query-parser
===============================

A query parser for REST-APIs based on the laravel framework

v1.1.9(4y ago)01551[1 PRs](https://github.com/IONext-B-V/laravel-api-query-parser/pulls)MITPHPPHP ^7.3

Since Feb 20Pushed 3y ago1 watchersCompare

[ Source](https://github.com/IONext-B-V/laravel-api-query-parser)[ Packagist](https://packagist.org/packages/ionext/laravel-api-query-parser)[ Docs](https://github.com/ionext/laravel-api-query-parser)[ RSS](/packages/ionext-laravel-api-query-parser/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (3)Versions (16)Used By (0)

Laravel API query parser
========================

[](#laravel-api-query-parser)

Description
-----------

[](#description)

This is a simple request query parameter parser for REST-APIs based on Laravel's framework.

Requirements
------------

[](#requirements)

- PHP &gt;=7.2
- Laravel framework &gt;= 6.2
- Mockery &gt;= 1.3 (dev)
- PHPUnit &gt;= 8.4 (dev)

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

[](#installation)

- Add ionext/laravel-api-query-parser to your composer.json and make composer update, or composer require ionext/laravel-api-query-parser
- Setup the service provider: in config/app.php add the following line: ```
    'providers' => [
        ...
        ApiQueryParser\Provider\RequestQueryParserProvider::class,
        ...
    ];
    ```

Usage
-----

[](#usage)

```
    // app/API/V1/Models/UserController.php
    namespace App\Api\V1\Http\Controllers;

    use App\Models\User;
    use App\Api\V1\Resources\UserResource;
    use App\Api\V1\Resources\UserResourceCollection;
    use ApiQueryParser\ResourceQueryParserTrait;
    use ApiQueryParser\BuilderParamsApplierTrait;

    class UserController extends Controller
    {
        use ResourceQueryParserTrait;
        use BuilderParamsApplierTrait;

        public function index(Request $request)
        {
            $params = $this->parseQueryParams($request);
            $query = User::query();
            $paginator = $this->applyParams($query, $params);

            return UserResourceCollection::make(
                $paginator
            );
        }
    }
```

Query syntax
------------

[](#query-syntax)

### Eager loading

[](#eager-loading)

Q: /users?connection\[\]=profile
R: will return the collection of the users with their profiles included

### Filtering

[](#filtering)

Q: /users?filter\[\]=name:ct:admin
R: will return the collection of the users whose names contains the admin string

**Available filter options**

OperatorDescriptionExamplectString containsname:ct:PeternctString NOT containsname:nct:PeterswString starts withusername:sw:adminewString ends withemail:ew:gmail.comeqEqualslevel:eq:3neNot equalslevel:ne:4gtGreater thanlevel:gt:2geGreater than or equallevel:ge:3ltLesser thanlevel:lt:4leLesser than or equallevel:le:3inIn arraylevel:in:1|2|3ninNot in arraylevel:nin:1|2|3#### Note on filtering based on relational values

[](#note-on-filtering-based-on-relational-values)

It is now possible to filter based on relational values using the table.column notation. eg. comments.author:eq:mike

### Locating

[](#locating)

Q: /users?location=longitude\_field:latitude\_field:0.000000:0.000000:10 R: This requires the user to have longitude and latitude fields. It will return the collection of the users within a given (10km) radius from the provided latitude and longitude. The distance to each entity will be passed via a custom distance column. When using location, a simple paginator will be used due to a bug in Laravel. This means the last page will be null.

#### Advanced location, joining tables

[](#advanced-location-joining-tables)

Q: /users?location=longitude\_field:latitude\_field:0.000000:0.000000:10:offices|office\_id R: Notice the last parameter separated by a pipe(|). This allows joining another table on containing the latitude and longitude information, adding location\_id, latitude and longitude fields to the final result.

### Sorting

[](#sorting)

Q: /users?sort\[\]=name:ASC
R: will return the collection of the users sort by their names ascending

### Pagination

[](#pagination)

Q: /users?limit=10&amp;page=3
R: will return a part of the collection of the users (from the 21st to 30th)

### Credits

[](#credits)

Package was originally developed by Gábor Németh (github: ) for Laravel Lumen(). The realisation of this package required some refactoring to be used with Laravel.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

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.

###  Release Activity

Cadence

Every ~43 days

Recently: every ~114 days

Total

14

Last Release

1710d ago

PHP version history (2 changes)v1.0.0PHP ^7.3

v1.0.1PHP ^7.2

### Community

Maintainers

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

---

Top Contributors

[![gydobroos](https://avatars.githubusercontent.com/u/37537231?v=4)](https://github.com/gydobroos "gydobroos (13 commits)")

---

Tags

apilaravelquery parser

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

2.9k34.0M112](/packages/darkaonline-l5-swagger)[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k12.2M45](/packages/knuckleswtf-scribe)[nickurt/laravel-postcodeapi

Universal PostcodeApi for Laravel 11.x/12.x/13.x

97221.2k](/packages/nickurt-laravel-postcodeapi)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)

PHPackages © 2026

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