{"id":31730776,"url":"https://github.com/victormgomes/query-params","last_synced_at":"2026-04-02T20:35:00.088Z","repository":{"id":315325008,"uuid":"1058300792","full_name":"VictorMGomes/query-params","owner":"VictorMGomes","description":"Automatically generate query parameters based on Eloquent Models","archived":false,"fork":false,"pushed_at":"2026-03-31T23:27:54.000Z","size":30,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-01T01:49:46.977Z","etag":null,"topics":["eloquent-orm","laravel","parameters","query","query-builder"],"latest_commit_sha":null,"homepage":"https://victormgomes.net","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VictorMGomes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-16T22:57:33.000Z","updated_at":"2026-03-31T23:27:25.000Z","dependencies_parsed_at":"2025-10-09T07:41:02.397Z","dependency_job_id":"04d84a67-abc0-4691-b3f1-c33750dbbf13","html_url":"https://github.com/VictorMGomes/query-params","commit_stats":null,"previous_names":["victormgomes/query-params"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/VictorMGomes/query-params","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorMGomes%2Fquery-params","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorMGomes%2Fquery-params/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorMGomes%2Fquery-params/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorMGomes%2Fquery-params/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VictorMGomes","download_url":"https://codeload.github.com/VictorMGomes/query-params/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorMGomes%2Fquery-params/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31315999,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eloquent-orm","laravel","parameters","query","query-builder"],"created_at":"2025-10-09T07:40:55.752Z","updated_at":"2026-04-02T20:35:00.029Z","avatar_url":"https://github.com/VictorMGomes.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Query Params\n\nAutomatically generate query parameters based on Eloquent Models\n\n## Features\n\nThis package provides automatic rules and a builder for query parameters to be used in GET routes for index requests.  \nThis includes rules generation and a query builder.  \nThe available parameter operations are:\n\n- Filters – equal, not equal, less than, and many others.  \n- Sorting – ascending and descending.  \n- Fields – fields to be included in the response.  \n- Includes – nested relations to be included in the response.  \n- Pagination – page limit and page number.  \n\n## Installation\n\n```bash\ncomposer require victormgomes/query-params\n```\n\n### Usage\n\n#### Rules generation\n\nFirst, use the `Rules::generate` method to inject the automatic query parameter rules into the rules of the desired class that extends a `FormRequest`.  \nYou must also provide a fully qualified class name (FQCN) as an argument, for example:\n\n```php\n//app/Http/Requests/Users/UserIndexRequest.php\n\u003c?php\n\nnamespace App\\Http\\Requests\\Users;\n\nuse App\\Models\\User\\User;\nuse Illuminate\\Foundation\\Http\\FormRequest;\nuse Victormgomes\\Queryparams\\Rules;\n\nclass UserIndexRequest extends FormRequest\n{\n    public function rules(): array\n    {\n        $rules = Rules::generate(User::class);\n\n        return $rules;\n    }\n}\n\n```\n\nNow the rules for your query parameters can handle incoming requests,  \nand can also be automatically described in OpenAPI documentation with tools like Scramble or Swagger.  \nAdditionally, you can import the OpenAPI JSON into tools like Postman to see all possible query parameters.  \n\nThe rules will look like this:\n\n![Alt text](https://raw.githubusercontent.com/VictorMGomes/art/refs/heads/main/query-params/images/rules-example.png)\n\n#### Query Builder\n\nIn the `index` method of the controller, use the `UserIndexRequest` class as the type of the incoming request.  \nThen, use the `QueryBuilder::build` method to build the query for the model,  \npassing the FQCN of the model and the request as arguments:\n\n```php\n//app/Http/Controllers/User/UserController.php\n\u003c?php\n\nnamespace App\\Http\\Controllers\\User;\n\nuse App\\Http\\Controllers\\Controller;\nuse App\\Http\\Requests\\Users\\UserIndexRequest;\nuse App\\Models\\User\\User;\nuse Victormgomes\\Queryparams\\QueryBuilder;\n\nclass UserController extends Controller\n{\n    public function index(UserIndexRequest $request): JsonResponse\n    {\n        $users = QueryBuilder::build(User::class, $request);\n\n        return response()-\u003ejson([\n            'status' =\u003e 'success',\n            'data' =\u003e $users,\n        ], 200);\n    }\n...\n}\n```\n\nNow you can make requests based on the generated rules.  \n\n### Many other improvements coming soon\n\nThanks!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictormgomes%2Fquery-params","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictormgomes%2Fquery-params","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictormgomes%2Fquery-params/lists"}