Skip to content

Repository files navigation

php-sleeper-api

Build StatusScrutinizer Code QualityCoverage Status

PHP from PackagistLatest Stable VersionTotal DownloadsLicense

Sleeper API PHP library for consuming fantasy content from official read-only Sleeper HTTP API

Installation

If you're using Composer to manage dependencies, you can run the following command:

$ composer require schoppax/php-sleeper-api

or add the following to your composer.json file:

"require": {
"schoppax/php-sleeper-api": "1.*",
}

Usage

useSchoppAx\Sleeper\SleeperClient;
$client = newSleeperClient();

Examples

League

Get a specific league by id:

try {
$league = $client->leagues()->find('289646328504385536');
echo$league['league_id'];
echo$league['name'];
echo$league['season'];
echo$league['roster_positions'];
} catch(BadMethodCallException$be) {
} catch(Exception$e) {
}

User

Get the user object by either providing the username or user_id:

try {
$user = $client->users()->find('2ksports');
echo$user['user_id'];
echo$user['username'];
echo$user['display_name'];
echo$user['avatar'];
} catch(BadMethodCallException$be) {
} catch(Exception$e) {
}

Implementation status

Sleeper ClassStatus
Avatars100%
Drafts100%
Leagues100%
Players100%
Users100%

About

Sleeper API PHP library for consuming fantasy content

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages