schoppax / php-sleeper-api
Sleeper API PHP library for consuming fantasy content
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/schoppax/php-sleeper-api
Requires
- php: >=7.3
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.4
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-10-07 02:16:53 UTC
README
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% |