PHPackages                             victormgomes/query-params - 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. [Database &amp; ORM](/categories/database)
4. /
5. victormgomes/query-params

ActiveLibrary[Database &amp; ORM](/categories/database)

victormgomes/query-params
=========================

Automatically generate query parameters from Eloquent models

1.0.1(2mo ago)2274MITPHPPHP ^8.3CI passing

Since Sep 24Pushed 2w agoCompare

[ Source](https://github.com/VictorMGomes/query-params)[ Packagist](https://packagist.org/packages/victormgomes/query-params)[ Docs](https://github.com/victormgomes/query-params)[ GitHub Sponsors](https://github.com/sponsors/VictorMGomes)[ RSS](/packages/victormgomes-query-params/feed)WikiDiscussions main Synced 2mo ago

READMEChangelog (10)Dependencies (66)Versions (15)Used By (0)

Laravel Query Engine
====================

[](#laravel-query-engine)

Automatically generates dynamic API parameters, strict validation, and optimized queries based on Eloquent Models.

Package Status
--------------

[](#package-status)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b060d73d5a76cc2843817d9e6fcef5ffb682b91a20ec7e183639a5a31d830146/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766963746f726d676f6d65732f6c61726176656c2d71756572792d656e67696e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/victormgomes/laravel-query-engine)[![Total Downloads](https://camo.githubusercontent.com/499e711becda640ea50570cb340821a711fd4d0bf90c701152725a9283dc4e74/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f766963746f726d676f6d65732f6c61726176656c2d71756572792d656e67696e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/victormgomes/laravel-query-engine)[![License](https://camo.githubusercontent.com/7d4fb5fb19582460904bbfe0cf75cdc457187e9d1339758fcd49572c33d1e681/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f766963746f726d676f6d65732f6c61726176656c2d71756572792d656e67696e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/victormgomes/laravel-query-engine)

[![PHP Versions](https://camo.githubusercontent.com/c23582b5a48e34936cbf8a4cfd74e39f798662da477fbd40bf2d11a5ab1f35cd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e335f2537435f382e345f2537435f382e352d3737374242342e7376673f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://php.net/)[![Laravel Versions](https://camo.githubusercontent.com/dba2cbca47a4c73b9d6d16d347ab076d5f7aca48b8f1da78e5b3f175fd822789/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31322e785f2537435f31332e782d3232433535452e7376673f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c)](https://laravel.com/)

[![Tests Status](https://camo.githubusercontent.com/09ffc6bf552feff13e86dbd6b411445dfdfb53402d2ccfe6fdfdb02e84b15803/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f766963746f726d676f6d65732f6c61726176656c2d71756572792d656e67696e652f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/victormgomes/laravel-query-engine/actions/workflows/ci.yml)[![Code Style Status](https://camo.githubusercontent.com/37ada845b9c40109d7559479c21fa7eadedd797eb0ea986b08f46b5a6894fa4f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f766963746f726d676f6d65732f6c61726176656c2d71756572792d656e67696e652f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/victormgomes/laravel-query-engine/actions/workflows/ci.yml)[![Code Quality Status](https://camo.githubusercontent.com/e393849055001fcec90fa36463ba11abed5ed82abe6784edb2abad3abaf59683/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f766963746f726d676f6d65732f6c61726176656c2d71756572792d656e67696e652f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d5048505374616e253230253236253230496e736967687473267374796c653d666c61742d737175617265)](https://github.com/victormgomes/laravel-query-engine/actions/workflows/ci.yml)

Why Use It?
-----------

[](#why-use-it)

Stop writing repetitive boilerplate for every index endpoint. `laravel-query-engine`acts as a seamless bridge between your HTTP requests and Eloquent.

It empowers a single RESTful controller to handle dynamic, infinitely complex API queries. It automatically handles all the heavy lifting—validation, type casting, and query construction—while respecting your model's native configuration.

You get the extreme flexibility of GraphQL, but with the simplicity and performance of standard Laravel REST APIs.

Features
--------

[](#features)

- **Automated Validation:** Generates strict validation rules directly from your database schema.
- **Dynamic Query Building:** Translates validated URL parameters directly into native Eloquent builder actions.
- **Strict Type Casting:** Inspects your schema to accurately cast URL strings into their correct PHP types (integers, booleans, dates).
- **Deep Security:** Natively respects your model's existing visibility configurations to prevent unmapped column exposure.
- **Advanced Querying:** Out-of-the-box support for full-text search, complex date filters, and nested logical groupings.
- **Model-Level Configuration:** Use native PHP attributes directly on your models to securely expose Local Scopes and query aggregations.
- **Exportable Schemas:** Easily export deduplicated filter schemas to generate dynamic frontend UIs or OpenAPI documentation.
- **AI Agent Ready:** Includes an official [Laravel Boost](https://github.com/laravel/boost) skill to automatically teach AI agents (like Claude Code and Cursor) how to use this package in your project.

How It Works
------------

[](#how-it-works)

Pass dynamic query parameters via the URL using standard arrays or JSON.

**The Request:**

```
GET /api/users?filters={"name":{"like":"John"},"status":"active"}&sorts={"created_at":"desc"}&includes={"posts":{}}

```

**What the package executes under the hood:**

```
User::where('name', 'LIKE', '%John%')
    ->where('status', 'active')
    ->orderBy('created_at', 'desc')
    ->with('posts')
    ->paginate();
```

---

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

[](#installation)

1. Install the package via Composer:

```
composer require victormgomes/laravel-query-engine
```

1. Publish the configuration file:

```
php artisan vendor:publish --tag="laravel-query-engine-config"
```

---

Quick Start
-----------

[](#quick-start)

### Step 1: Auto-generate validation rules

[](#step-1-auto-generate-validation-rules)

Annotate your FormRequest with `#[MapQueryEngine(Model::class)]`.

```
// app/Http/Requests/IndexUserRequest.php
use Illuminate\Foundation\Http\FormRequest;
use Victormgomes\LaravelQueryEngine\Attributes\MapQueryEngine;
use Victormgomes\LaravelQueryEngine\Traits\HasQueryEngineRules;
use App\Models\User;

#[MapQueryEngine(User::class)]
class IndexUserRequest extends FormRequest
{
    use HasQueryEngineRules;

    public function authorize(): bool
    {
        return true;
    }
}
```

It generates the validation rules based on the model schema.

### Step 2: Build the query

[](#step-2-build-the-query)

The package automatically adds powerful new methods directly to all your Eloquent models. You can call these anywhere in your application (such as a Controller or a Service class) by simply passing the validated request:

```
// app/Http/Controllers/UserController.php
use App\Models\User;
use App\Http\Requests\IndexUserRequest;
use Illuminate\Pagination\LengthAwarePaginator;

public function index(IndexUserRequest $request): LengthAwarePaginator
{
    // Pass the request to automatically apply all URL parameters
    return User::paginateQuery($request);
}
```

This returns a `LengthAwarePaginator` with all valid filters, sorts, includes, and pagination automatically applied.

---

Documentation
-------------

[](#documentation)

For a deep dive into the features, please read the [Official Documentation](https://laravel-query-engine.victormgomes.net/).

---

Credits
-------

[](#credits)

- [Victor M. Gomes](https://github.com/victormgomes)
- [All Contributors](https://github.com/victormgomes/laravel-query-engine/graphs/contributors)

Support Us
----------

[](#support-us)

If you find this package useful in your day-to-day development, please consider [sponsoring my work](https://github.com/sponsors/VictorMGomes) or leaving a ⭐ on the repository. Your support directly helps keep this project actively maintained and free!

---

Community &amp; Guidelines
--------------------------

[](#community--guidelines)

- [Upgrading Guide](https://laravel-query-engine.victormgomes.net/UPGRADING)
- [Changelog](https://github.com/victormgomes/laravel-query-engine/releases)
- [Contributing](https://github.com/victormgomes/laravel-query-engine/blob/main/.github/CONTRIBUTING.md)
- [Code of Conduct](https://github.com/victormgomes/laravel-query-engine/blob/main/.github/CODE_OF_CONDUCT.md)
- [Security Policy](https://github.com/victormgomes/laravel-query-engine/blob/main/.github/SECURITY.md)
- [Support &amp; Help](https://github.com/victormgomes/laravel-query-engine/blob/main/.github/SUPPORT.md)

---

License
-------

[](#license)

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

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance91

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 59.1% 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 ~20 days

Recently: every ~7 days

Total

13

Last Release

82d ago

Major Versions

0.0.12 → 1.0.02026-05-26

PHP version history (2 changes)0.0.5PHP ^8.4

0.0.12PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20375480?v=4)[Victor M. Gomes](/maintainers/victormgomes)[@VictorMGomes](https://github.com/VictorMGomes)

---

Top Contributors

[![victormgomes](https://avatars.githubusercontent.com/u/20375480?v=4)](https://github.com/victormgomes "victormgomes (88 commits)")[![VictorMGomes](https://avatars.githubusercontent.com/u/20375480?v=4)](https://github.com/VictorMGomes "VictorMGomes (52 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")

---

Tags

apieloquentfilterfilteringgraphqljson-apilaravelpaginationqueryquery-builderquery-paramsrelationshipsrestrest-apischemasearchsortsortingtype-safevalidationlaravelVictor M. Gomesquery-params

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/victormgomes-query-params/health.svg)

```
[![Health](https://phpackages.com/badges/victormgomes-query-params/health.svg)](https://phpackages.com/packages/victormgomes-query-params)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-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)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

818355.4k3](/packages/defstudio-telegraph)[spatie/laravel-health

Monitor the health of a Laravel application

88212.7M189](/packages/spatie-laravel-health)[masterix21/laravel-licensing

Laravel licensing package with polymorphic assignment to any model, activation keys, expirations/renewals, and seat control via LicenseUsage. Supports offline verification with public-key–signed tokens, a CLI to generate/rotate/revoke keys, and an extensible architecture via config and contracts.

1614.1k4](/packages/masterix21-laravel-licensing)

PHPackages © 2026

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