Skip to content

PaginatedResult ​

php
class Zairakai\LaravelTwitch\Dto\PaginatedResult

Generic wrapper for paginated Twitch API responses.

Usage:

php
$raw = Twitch::getStreams();
$result = PaginatedResult::fromRaw($raw, Stream::class);

foreach ($result->items as $stream) {
    echo $stream->userName; // Stream instance
}

if ($result->hasMore()) {
    $next = Twitch::getStreams(after: $result->cursor);
}

Source: src/Dto/PaginatedResult.php

Methods ​

__construct() ​

php
public function __construct(array $items, string $cursor, int $total = null)
ParameterDescription
$itemsHydrated DTO instances
$cursorCursor for the next page (null = no more pages)
$totalTotal count (if provided by the API)

fromRaw() ​

php
public static function fromRaw(array $raw, string $dtoClass): self

Build a PaginatedResult from a raw Twitch API response array.

ParameterDescription
$rawRaw response from makeRequest()
$dtoClassDTO class to hydrate each item

Returns self<TItem>

count() ​

php
public function count(): int

Number of items in the current page.

hasMore() ​

php
public function hasMore(): bool

Whether more pages are available.

Documentation of 4.1.4 , built from a03e949 on 4.1.4 by pipeline #2949087255 on 2026-10-11.