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
=========================

Automatic query parameters generation based on eloquent models

0.0.4(1mo ago)1107MITPHP

Since Sep 24Pushed 1mo agoCompare

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

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Query Params
============

[](#query-params)

Automatically generate query parameters based on Eloquent Models

Features
--------

[](#features)

This package provides automatic rules and a builder for query parameters to be used in GET routes for index requests.
This includes rules generation and a query builder.
The available parameter operations are:

- Filters – equal, not equal, less than, and many others.
- Sorting – ascending and descending.
- Fields – fields to be included in the response.
- Includes – nested relations to be included in the response.
- Pagination – page limit and page number.

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

[](#installation)

```
composer require victormgomes/query-params
```

### Usage

[](#usage)

#### Rules generation

[](#rules-generation)

First, use the `Rules::generate` method to inject the automatic query parameter rules into the rules of the desired class that extends a `FormRequest`.
You must also provide a fully qualified class name (FQCN) as an argument, for example:

```
//app/Http/Requests/Users/UserIndexRequest.php
