Tuner Docs

A Laravel package to fine-tune your APIs.

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

Projection (columns, columns!)

The projection feature allows clients to include or exclude specific columns from the API response using query parameters. This helps optimize payload size and gives frontend consumers more control over the data they receive.



Include Specific Fields

Request
GET /api/users?columns=id,name,email

Where id, name, and email are the columns to include in the response.

Query Parameters
Name Type Description
columns string Comma-separated list of columns to include.

Response
[
  {
    "id": 1,
    "name": "Benjamin Heidenreich",
    "email": "quinton42@example.net"
  },
  {
    "id": 2,
    "name": "Jairo Armstrong",
    "email": "damian83@example.org"
  }
]


Exclude Specific Fields

Request
GET /api/users?columns!=created_at,updated_at

Where created_at and updated_at are the columns to exclude from the response.

Query Parameters
Name Type Description
columns! string Comma-separated list of columns to exclude.
Response
[
  {
    "id": 1,
    "name": "Benjamin Heidenreich",
    "email": "quinton42@example.net",
    "email_verified_at": "2025-04-17T01:19:49.000000Z"
  },
  {
    "id": 2,
    "name": "Jairo Armstrong",
    "email": "damian83@example.org",
    "email_verified_at": "2025-04-17T01:19:49.000000Z"
  }
]