Tuner Docs

A Laravel package to fine-tune your APIs.

View on GitHub
📚 Documentation
🧪 Basic Features
🧪 Intermediate Features
🧪 Advanced Features

Pagination (per-page, page)

The pagination feature allows clients to retrieve paginated results along with navigation metadata like total count, current page, and pagination links.



Request
GET /api/users?per-page=3&page=2

Fetch 3 records per page, displaying page 2.


Query Parameters
Name Type Description
page-size int Number of items per page
page int Page number to retrieve (optional, default is 1)
Response
{
  "current_page": 2,
  "data": [
    {
      "id": 4,
      "name": "...",
      ...
    },
    {
      "id": 5,
      "name": "...",
      ...
    },
    {
      "id": 6,
      "name": "...",
      ...
    }
  ],
  "first_page_url": "http://localhost/api/users?page=1",
  "from": 4,
  "last_page": 7,
  "last_page_url": "http://localhost/api/users?page=7",
  "links": [
    {
      "url": "http://localhost/api/users?page=1",
      "label": "« Previous",
      "active": false
    },
    ...
  ],
  "next_page_url": "http://localhost/api/users?page=3",
  "path": "http://localhost/api/users",
  "per_page": 3,
  "prev_page_url": "http://localhost/api/users?page=1",
  "to": 6,
  "total": 20
}