danabrey/sleeper-api

PHP library for interacting with the sleeper.app fantasy football API

v0.7 2024-05-17 16:31 UTC

This package is auto-updated.

Last update: 2024-05-17 16:32:01 UTC


README

PHP library for interacting with the read-only Sleeper fantasy football API.

PHP Composer

Installation

composer require danabrey/sleeper-api

Usage

Create an instance of the client

$client = new DanAbrey\SleeperApi\SleeperApiClient();

No API key is required for the Sleeper API, as it is read-only and they do not track requests in this way.

$client->league('xxxxx') where xxxxx is the league ID, for basic league info $client->rosters('xxxxx') where xxxxx is the league ID, for all rosters $client->users('xxxxx') where xxxxx is the league ID, for all users in a league

All methods return either a single instance or an array of plain PHP objects that represent the data returned. e.g. SleeperRoster

Note

It is your responsibility to abide by the terms of the Sleeper API.

Running tests

./vendor/bin/phpunit