https://github.com/victormgomes/query-params
Automatically generate query parameters based on Eloquent Models
https://github.com/victormgomes/query-params
eloquent-orm laravel parameters query query-builder
Last synced: 3 months ago
JSON representation
Automatically generate query parameters based on Eloquent Models
- Host: GitHub
- URL: https://github.com/victormgomes/query-params
- Owner: VictorMGomes
- License: mit
- Created: 2025-09-16T22:57:33.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2026-03-31T23:27:54.000Z (3 months ago)
- Last Synced: 2026-04-01T01:49:46.977Z (3 months ago)
- Topics: eloquent-orm, laravel, parameters, query, query-builder
- Language: PHP
- Homepage: https://victormgomes.net
- Size: 29.3 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Query Params
Automatically generate query parameters based on Eloquent Models
## 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
```bash
composer require victormgomes/query-params
```
### Usage
#### 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:
```php
//app/Http/Requests/Users/UserIndexRequest.php
json([
'status' => 'success',
'data' => $users,
], 200);
}
...
}
```
Now you can make requests based on the generated rules.
### Many other improvements coming soon
Thanks!