Pagination

  1. Rate Limiting
  2. JWT Authentication
  3. Idempotency
  4. API Keys
  5. API Versioning
  6. Pagination
  7. Consistent Error Format
Client
Server

Before

class ProductController
{
    public function index(): JsonResponse
    {
        // every product, every request —
        // fine at 50 rows, not at 500,000
        return response()->json(Product::all());
    }
}

After

class ProductController
{
    public function index(): JsonResponse
    {
        $page = Product::query()
            ->orderBy('id')
            ->cursorPaginate(50);

        return response()->json($page);
    }
}
{CC}