danabrey / sleeper-api
PHP library for interacting with the sleeper.app fantasy football API
Requires
- php: ^7.4|^8.0
- ext-json: *
- symfony/http-client: ^5.1|^6.0|^7.0
- symfony/property-access: ^5.1|^6.0|^7.0
- symfony/serializer: ^5.1|^6.0|^7.0
Requires (Dev)
- phpunit/phpunit: ^9
README
PHP library for interacting with the read-only Sleeper fantasy football API.
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