spatie/laravel-query-builder) lets you build Eloquent queries directly from API request query parameters. Geni statically inspects QueryBuilder::for(...) method chains in your controller actions on GET operations and generates corresponding OpenAPI query parameters — no application boot, no database connection, no annotations required.
Example Controller Action
Given a controller action like this:Generated OpenAPI Query Parameters
Filters (filter[...])
Each entry in allowedFilters() becomes a bracketed query parameter:
If the filtered property matches a column on the model’s table, Geni automatically assigns the database column type (e.g.,
integer, boolean, string) resolved from your migrations.
Sorts (sort)
Geni combines all allowedSorts entries into a single sort query parameter:
- Name:
sort - In:
query - Type:
string - Enum:
['name', '-name', 'created_at', '-created_at'] - Default:
'-created_at'(extracted fromdefaultSort) - Description:
"Comma-separated list of fields to sort by. Prefix with '-' for descending order."
Includes (include)
- Name:
include - In:
query - Type:
string - Enum:
['posts', 'posts.comments'] - Description:
"Comma-separated list of relationships to include."
Sparse Fieldsets (fields[...])
fields[users]:type: string, sparse fieldset for the primary model.fields[posts]:type: string, sparse fieldset for the related model.
Appends (append)
- Name:
append - In:
query - Type:
string - Enum:
['full_name'] - Description:
"Comma-separated list of dynamic accessors or appends to include."
Handling Dynamic Arguments
If you pass dynamic arguments or variables to builder methods (e.g.,
allowedFilters($dynamicFilters)), Geni skips those dynamic values and continues parsing the remaining literal configuration without failing. Any literal entries in the same call are still fully documented.