hongxunpan/eloquent-query-dsl
A fluent query DSL for Laravel's Eloquent ORM that lets you build database queries with a clean, chainable syntax. Simplifies complex filtering, sorting, and relationship queries into readable, expressive code for more maintainable models and repositories.
QueryDsl and DslInputMap APIs. QueryDsl::apply() is the main entry point for normalizing raw request input into either page or cursor pagination mode. DslInputMap controls the public cursor parameter names.page input or a structured cursor input, pass the raw request keys into QueryDsl::apply(), then branch on the returned pagination mode to build your Eloquent query.$pagination = QueryDsl::apply($request->query());
// Branch on page vs cursor mode from the structured result,
// then apply ordering/scopes and execute the query yourself.
The package validates cursor input and constructs Illuminate cursor objects. Your application still owns query execution, authorization, and response formatting.
page or cursor, never both. Return a clear 422 response if both are supplied.page key and let QueryDsl::apply() select page mode.next, previous, and position. Use next for forward navigation and previous for backward navigation. Treat position as a debugging aid rather than a primary client-facing pagination token.DslInputMap when your public API uses different cursor parameter names, such as after/before. Keep validation rules, request docs, DslInputMap, and response metadata aligned.QueryDsl::apply() with raw request input.{
"data": [],
"pagination": {
"mode": "cursor",
"cursor": {
"next": "...",
"previous": "...",
"position": "..."
}
}
}
position in debug environments. Do not change the page-mode response contract when adding cursor support.QueryDsl::apply() determines pagination mode only from the original raw input keys. Do not pass a DTO or merged defaults that always include page; that can accidentally force page mode even when the client sent a cursor. Pass $request->query() or a carefully filtered raw array.page=1 before calling QueryDsl::apply().next/previous navigation can skip or duplicate records.DslInputMap first, then confirm the request uses the expected public parameter names. Use position to reproduce and debug cursor state.next and backward with previous. Also test the mutual-exclusivity rule and custom cursor parameter names.DslInputMap mappings and your own response serializer/query builder integration. Keep custom cursor names consistent across validation, QueryDsl::apply(), and response output.How can I help you explore Laravel packages today?