PHPackages                             hotsaucejake/laravel-sleeper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. hotsaucejake/laravel-sleeper

ActiveLibrary[API Development](/categories/api)

hotsaucejake/laravel-sleeper
============================

An API wrapper for the fantasy sleeper app

v1.3.1(9mo ago)036[3 PRs](https://github.com/hotsaucejake/laravel-sleeper/pulls)MITPHPPHP ^8.2|^8.3|^8.4CI passing

Since Dec 15Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/hotsaucejake/laravel-sleeper)[ Packagist](https://packagist.org/packages/hotsaucejake/laravel-sleeper)[ Docs](https://github.com/hotsaucejake/laravel-sleeper)[ RSS](/packages/hotsaucejake-laravel-sleeper/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (9)Versions (12)Used By (0)

Laravel Sleeper API Wrapper
===========================

[](#laravel-sleeper-api-wrapper)

A comprehensive Laravel package for interacting with the [Sleeper Fantasy Sports API](https://sleeper.com). This package provides easy access to all Sleeper API endpoints including users, leagues, drafts, players, and more.

**Official Sleeper Resources:**

- [Sleeper App](https://sleeper.com)
- [Sleeper API Documentation](https://docs.sleeper.com/)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require hotsaucejake/laravel-sleeper
```

API Overview
------------

[](#api-overview)

The Sleeper API is read-only and requires no authentication. All methods return JSON objects/arrays containing the requested data. Rate limit: stay under 1000 calls per minute.

Complete Usage Guide
--------------------

[](#complete-usage-guide)

```
use HOTSAUCEJAKE\LaravelSleeper\Facades\LaravelSleeper;
```

---

👤 User Endpoints
----------------

[](#-user-endpoints)

### `getUserByName(string $username)`

[](#getuserbynamestring-username)

Retrieves user information by username.

```
$user = LaravelSleeper::getUserByName('sleeperuser');
// Returns: { "username": "sleeperuser", "user_id": "12345678", "display_name": "SleeperUser", "avatar": "..." }
```

### `getUserById(string $user_id)`

[](#getuserbyidstring-user_id)

Retrieves user information by user ID. Recommended over username since usernames can change.

```
$user = LaravelSleeper::getUserById('12345678');
// Returns: Same format as getUserByName()
```

---

🖼️ Avatar Endpoints
-------------------

[](#️-avatar-endpoints)

### `showAvatar(string $avatar_id)`

[](#showavatarstring-avatar_id)

Returns the full-size avatar URL for a given avatar ID.

```
$avatarUrl = LaravelSleeper::showAvatar('cc12ec49965eb7856f84d71cf85306af');
// Returns: "https://sleepercdn.com/avatars/cc12ec49965eb7856f84d71cf85306af"
```

### `showAvatarThumbnail(string $avatar_id)`

[](#showavatarthumbnailstring-avatar_id)

Returns the thumbnail avatar URL for a given avatar ID.

```
$thumbnailUrl = LaravelSleeper::showAvatarThumbnail('cc12ec49965eb7856f84d71cf85306af');
// Returns: "https://sleepercdn.com/avatars/thumbs/cc12ec49965eb7856f84d71cf85306af"
```

---

🏆 League Endpoints
------------------

[](#-league-endpoints)

### `getAllLeaguesForUser(string $user_id, int $season, string $sport = 'nfl')`

[](#getallleaguesforuserstring-user_id-int-season-string-sport--nfl)

Retrieves all leagues for a specific user in a given season.

```
$leagues = LaravelSleeper::getAllLeaguesForUser('12345678', 2024);
// Returns: Array of league objects with settings, roster info, scoring settings, etc.
```

### `getLeague(string $league_id)`

[](#getleaguestring-league_id)

Retrieves detailed information about a specific league.

```
$league = LaravelSleeper::getLeague('289646328504385536');
// Returns: Single league object with full configuration details
```

### `getLeagueRosters(string $league_id)`

[](#getleaguerostersstring-league_id)

Retrieves all rosters in a league with current players, starters, and team records.

```
$rosters = LaravelSleeper::getLeagueRosters('289646328504385536');
// Returns: Array of roster objects with starters[], players[], settings{wins, losses, points}, etc.
```

### `getLeagueUsers(string $league_id)`

[](#getleagueusersstring-league_id)

Retrieves all users/managers in a league with their team information.

```
$users = LaravelSleeper::getLeagueUsers('289646328504385536');
// Returns: Array of user objects with metadata{team_name}, is_owner (commissioner status), etc.
```

### `getLeagueMatchups(string $league_id, int $week)`

[](#getleaguematchupsstring-league_id-int-week)

Retrieves all matchups for a specific week. Teams with the same `matchup_id` play each other.

```
$matchups = LaravelSleeper::getLeagueMatchups('289646328504385536', 1);
// Returns: Array with starters[], players[], matchup_id, points, custom_points
```

### `getLeaguePlayoffWinnersBracket(string $league_id)`

[](#getleagueplayoffwinnersbracketstring-league_id)

Retrieves the winners bracket for league playoffs.

```
$bracket = LaravelSleeper::getLeaguePlayoffWinnersBracket('289646328504385536');
// Returns: Array of bracket rounds with team progressions and results
```

### `getLeaguePlayoffLosersBracket(string $league_id)`

[](#getleagueplayofflosersbracketstring-league_id)

Retrieves the losers bracket for league playoffs (consolation bracket).

```
$bracket = LaravelSleeper::getLeaguePlayoffLosersBracket('289646328504385536');
// Returns: Array of bracket rounds for consolation games
```

### `getLeagueTransactions(string $league_id, int $round)`

[](#getleaguetransactionsstring-league_id-int-round)

Retrieves all transactions (trades, waivers, free agents) for a specific week/round.

```
$transactions = LaravelSleeper::getLeagueTransactions('289646328504385536', 1);
// Returns: Array of transactions with type, adds{}, drops{}, draft_picks[], waiver_budget[]
```

### `getLeagueTradedPicks(string $league_id)`

[](#getleaguetradedpicksstring-league_id)

Retrieves all traded draft picks in a league, including future picks.

```
$tradedPicks = LaravelSleeper::getLeagueTradedPicks('289646328504385536');
// Returns: Array with season, round, roster_id (original), owner_id (current)
```

### `getSportState(string $sport = 'nfl')`

[](#getsportstatestring-sport--nfl)

Retrieves current state information for the sport (current week, season, etc.).

```
$state = LaravelSleeper::getSportState('nfl');
// Returns: { week, season_type, season, previous_season, league_season, display_week }
```

---

📋 Draft Endpoints
-----------------

[](#-draft-endpoints)

### `getDraftsForUser(string $user_id, int $season, string $sport = 'nfl')`

[](#getdraftsforuserstring-user_id-int-season-string-sport--nfl)

Retrieves all drafts for a specific user in a given season.

```
$drafts = LaravelSleeper::getDraftsForUser('12345678', 2024);
// Returns: Array of draft objects with type, status, settings, metadata
```

### `getLeagueDrafts(string $league_id)`

[](#getleaguedraftsstring-league_id)

Retrieves all drafts for a specific league (dynasty leagues may have multiple drafts).

```
$drafts = LaravelSleeper::getLeagueDrafts('289646328504385536');
// Returns: Array of draft objects sorted by most recent
```

### `getSpecificDraft(string $draft_id)`

[](#getspecificdraftstring-draft_id)

Retrieves detailed information about a specific draft.

```
$draft = LaravelSleeper::getSpecificDraft('289646328508579840');
// Returns: Draft object with draft_order{}, slot_to_roster_id{}, settings{}
```

### `getDraftPicks(string $draft_id)`

[](#getdraftpicksstring-draft_id)

Retrieves all picks made in a specific draft with player details.

```
$picks = LaravelSleeper::getDraftPicks('289646328508579840');
// Returns: Array of picks with player_id, picked_by, roster_id, round, metadata{player info}
```

### `getDraftTradedPicks(string $draft_id)`

[](#getdrafttradedpicksstring-draft_id)

Retrieves all traded picks within a specific draft.

```
$tradedPicks = LaravelSleeper::getDraftTradedPicks('289646328508579840');
// Returns: Array similar to league traded picks but specific to this draft
```

---

🏈 Player Endpoints
------------------

[](#-player-endpoints)

### `getAllPlayers(string $sport = 'nfl')`

[](#getallplayersstring-sport--nfl)

Retrieves all players in the database. **Important:** This is a large response (~5MB) - cache locally and call max once per day.

```
$players = LaravelSleeper::getAllPlayers('nfl');
// Returns: Object with player_id as keys, player objects with name, position, team, stats, etc.
```

### `getTrendingPlayers(string $type = 'add', string $sport = 'nfl', int $lookback_hours = 24, int $limit = 25)`

[](#gettrendingplayersstring-type--add-string-sport--nfl-int-lookback_hours--24-int-limit--25)

Retrieves trending players based on add/drop activity.

```
// Most added players in last 24 hours
$trending = LaravelSleeper::getTrendingPlayers('add');

// Most dropped players in last 48 hours, limit 10
$dropped = LaravelSleeper::getTrendingPlayers('drop', 'nfl', 48, 10);

// Returns: Array of { player_id, count } objects
```

---

💡 Usage Tips
------------

[](#-usage-tips)

### Working with Player IDs

[](#working-with-player-ids)

Player IDs can be numeric strings (`"1042"`) or team abbreviations (`"CAR"` for team defenses).

```
// Get all players to create a lookup map
$players = LaravelSleeper::getAllPlayers();
$playerName = $players['1042']['first_name'] . ' ' . $players['1042']['last_name'];
$teamDefense = $players['CAR']['position']; // "DEF"
```

### Finding Matchup Results

[](#finding-matchup-results)

Teams with the same `matchup_id` play against each other:

```
$matchups = LaravelSleeper::getLeagueMatchups('league_id', 1);
foreach ($matchups as $team) {
    // Find opponent by matching matchup_id
    $opponent = collect($matchups)->where('matchup_id', $team['matchup_id'])
                                  ->where('roster_id', '!=', $team['roster_id'])
                                  ->first();
}
```

### Calculating Bench Players

[](#calculating-bench-players)

Bench players = All players - Starting players:

```
$roster = LaravelSleeper::getLeagueRosters('league_id')[0];
$bench = array_diff($roster['players'], $roster['starters']);
```

Testing
-------

[](#testing)

In order to run the package tests you must create an `.env` file from the `.env.example` file. Tests will use the live endpoints. Since it's under the API rate limit, it's ok for now. I don't think this package will get any bigger than it already is so no need for mocks, etc...

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [hotsaucejake](https://github.com/hotsaucejake)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance73

Regular maintenance activity

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 65.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~254 days

Total

5

Last Release

278d ago

PHP version history (3 changes)v1.0.0PHP ^8.1

v1.2.1PHP ^8.1|^8.2|^8.3

v1.3.0PHP ^8.2|^8.3|^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6332533?v=4)[Jakob Crowder](/maintainers/hotsaucejake)[@hotsaucejake](https://github.com/hotsaucejake)

---

Top Contributors

[![hotsaucejake](https://avatars.githubusercontent.com/u/6332533?v=4)](https://github.com/hotsaucejake "hotsaucejake (30 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")

---

Tags

laravelhotsaucejakelaravel-sleepersleeper api

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/hotsaucejake-laravel-sleeper/health.svg)

```
[![Health](https://phpackages.com/badges/hotsaucejake-laravel-sleeper/health.svg)](https://phpackages.com/packages/hotsaucejake-laravel-sleeper)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k108.5M885](/packages/laravel-socialite)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M985](/packages/statamic-cms)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M164](/packages/spatie-laravel-health)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1123.7k](/packages/codebar-ag-laravel-docuware)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
