Instead of returning primitive arrays which contain the API responses we've used Laravel's Collections. These are powerful and flexible alternatives to the native array structure and lets achieve more with less code.

Using a Collection

Every index documented on the Riot DTO pages are accessible in two ways using a colleciton. You can use array access notation or object access. Here is an example

$collection = Client::summoner('euw')->name('supergrecko');

// We now have a Summoner collection. Let's access some data.
$name = $collection->name; // object access
$name = $collection["name"]; // array access

Collection Methods

All collections have a set of methods available. These can be found at the Laravel Collections docs.

Let's show an example using the Collection::map method.

$collection = Client::spectator('euw')->featured();

// Echo each game ID on a new line.
$collection->gameList->map(function ($game) {
    echo $game->gameId . PHP_EOL;

List of Collections