SchoppAx / php-sleeper-api

Sleeper API PHP library for consuming fantasy content

Home Page:https://schoppax.github.io/php-sleeper-api/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

php-sleeper-api

Build Status Scrutinizer Code Quality Coverage Status

PHP from Packagist Latest Stable Version Total Downloads License

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

use SchoppAx\Sleeper\SleeperClient;

$client = new SleeperClient();

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 Class Status
Avatars 100%
Drafts 100%
Leagues 100%
Players 100%
Users 100%

About

Sleeper API PHP library for consuming fantasy content

https://schoppax.github.io/php-sleeper-api/

License:MIT License


Languages

Language:PHP 100.0%