Skip to content
API/LaravelResponseStrategy

LaravelResponseStrategy

src/strategies/laravel-response.strategy.ts1 public methodsclass

Response strategy for the Laravel (pagination-only) driver

Parses flat Laravel pagination responses:

{
"data": [...],
"current_page": 1,
"total": 100,
"per_page": 15,
"from": 1,
"to": 15,
"next_page_url": "...",
"prev_page_url": "...",
"first_page_url": "...",
"last_page": 7,
"last_page_url": "..."
}

The traversal algorithm (flat response[options.X] lookups) is inherited from AbstractFlatResponseStrategy; this class exists so DriverEnum.LARAVEL resolves to a distinct identity at the DI layer even though the parsing logic is shared with Spatie.

new LaravelResponseStrategy()
paginate(response: RawResponse, options: ResponseOptions): PaginatedCollection<T>

Parse a flat-envelope pagination response into a PaginatedCollection

Parameter Type Description
response RawResponse The raw API response object
options ResponseOptions The response key name configuration

Returns — A typed PaginatedCollection instance