Skip to content

Commit

Permalink
Add examples and implementation status
Browse files Browse the repository at this point in the history
  • Loading branch information
SchoppAx committed Nov 27, 2021
1 parent 279268c commit bfdf593
Showing 1 changed file with 51 additions and 16 deletions.
67 changes: 51 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,80 @@
# sleeper-api-php-lib
========================

Sleeper API PHP library for consuming fantasy content from [official read-only Sleeper HTTP API](https://docs.sleeper.app/)
sleeper-api-php-lib
===================

[![Build Status](https://www.travis-ci.org/SchoppAx/sleeper-api-php-lib.svg?branch=master)](https://www.travis-ci.org/SchoppAx/sleeper-api-php-lib)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/SchoppAx/sleeper-api-php-lib/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/SchoppAx/sleeper-api-php-lib/?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/SchoppAx/sleeper-api-php-lib/badge.svg?branch=master)](https://coveralls.io/github/SchoppAx/sleeper-api-php-lib?branch=master)

[![PHP from Packagist](https://poser.pugx.org/schoppax/sleeper-api-php-lib/require/php)](https://packagist.org/packages/schoppax/sleeper-api-php-lib)
[![Latest Stable Version](https://poser.pugx.org/schoppax/sleeper-api-php-lib/v/stable)](https://packagist.org/packages/schoppax/sleeper-api-php-lib)
[![Total Downloads](https://poser.pugx.org/schoppax/sleeper-api-php-lib/downloads)](https://packagist.org/packages/schoppax/sleeper-api-php-lib)
[![PHP from Packagist](https://poser.pugx.org/schoppax/sleeper-api-php-lib/require/php)](https://packagist.org/packages/schoppax/sleeper-api-php-lib)
[![License](https://poser.pugx.org/schoppax/sleeper-api-php-lib/license.png)](https://packagist.org/packages/schoppax/sleeper-api-php-lib)

Sleeper API PHP library for consuming fantasy content from [official read-only Sleeper HTTP API](https://docs.sleeper.app/)

## Install
# Installation

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

```sh
composer require schoppax/sleeper-api-php-lib
$ composer require schoppax/sleeper-api-php-lib
```

or add to your composer.json file:

"require": {
"schoppax/sleeper-api-php-lib": "1.*",
}
or add the following to your composer.json file:
```json
"require": {
"schoppax/sleeper-api-php-lib": "1.*",
}
```

# Example
# Usage

``` php

use SchoppAx\Sleeper\SleeperClient;

$client = new SleeperClient();
```

## Examples

### League
Get a specific league by id:
``` php
try {
$league = (object) $client->leagues()->find('289646328504385536');
$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:
``` 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) {

}
```

## Implementation status

| Sleeper Class | Status |
| ------------- | :-----:|
| Avatars | 100% |
| Drafts | 100% |
| Leagues | 78% |
| Players | 100% |
| Users | 100% |

0 comments on commit bfdf593

Please sign in to comment.