This package doesn’t provide any methods to help you paginate responses. However as documented above you can use Laravel’s default paginate() method.

If you want to completely adhere to the JSON API specification you can also use our own spatie/json-api-paginate!

Adding Parameters to Pagination

By default the query parameters wont be added to the pagination json. You can append the request query to the pagination json by using the appends method available on the LengthAwarePaginator.

$users = QueryBuilder::for(User::class)
    ->allowedFilters(['name', 'email'])