PHP code example of schoppax / php-sleeper-api

1. Go to this page and download the library: Download schoppax/php-sleeper-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

schoppax / php-sleeper-api example snippets

json
"choppax/php-sleeper-api": "1.*",
}
 php
use SchoppAx\Sleeper\SleeperClient;

$client = new SleeperClient();
 php
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) {

}
 php
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) {

}