PHPackages                             furic/leaderboards - 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. furic/leaderboards

ActiveLibrary[API Development](/categories/api)

furic/leaderboards
==================

RESTful API serving the leaderboards and reporting the scores to your client app.

1.0.2(5y ago)211MITPHPPHP ^7.2

Since Jan 18Pushed 5y ago1 watchersCompare

[ Source](https://github.com/furic/laravel-leaderboards)[ Packagist](https://packagist.org/packages/furic/leaderboards)[ Docs](https://github.com/furic/laravel-leaderboards)[ Fund](https://paypal.me/furic)[ GitHub Sponsors](https://github.com/furic)[ RSS](/packages/furic-leaderboards/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

laravel-leaderboards
====================

[](#laravel-leaderboards)

[![Packagist](https://camo.githubusercontent.com/a6035bd6f735a4a7f0c7cd163120bbea12a815b35d553ab04aa11ca31578c7bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66757269632f6c6561646572626f61726473)](https://packagist.org/packages/furic/leaderboards)[![Packagist](https://camo.githubusercontent.com/788ad60bdcb4ca5345b041a912b70ba3a6f3b178826f7955aba1b7a30d396623/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66757269632f6c6561646572626f61726473)](https://packagist.org/packages/furic/leaderboards)[![License](https://camo.githubusercontent.com/81d30e23c2780b26331425d53159de5955ebdef98ad6881ea393220e269e88b0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f66757269632f6c61726176656c2d6c6561646572626f61726473)](https://packagist.org/packages/furic/leaderboards)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9259485ce3846c86e0117c51f0ebc6d13f297979fa84a00baa92fa99982b0886/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f66757269632f6c61726176656c2d6c6561646572626f617264732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/furic/laravel-leaderboards/?branch=master)[![Build Status](https://camo.githubusercontent.com/e6c546738c81df4107a2b6b1068e4c38df88bc6933adaa3f555a77833594559a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f66757269632f6c61726176656c2d6c6561646572626f617264732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/furic/laravel-leaderboards/build-status/master)

> Leaderboards management for [Laravel 5.\*](https://laravel.com/). This package is developed while working for a leaderboard solution in [Sweaty Chair Studio](https://www.sweatychair.com), serving leaderboards to players. This contains RESTful API for reading the leaderboard in daily, weekly, monthly or all-time period, reporting players' scores to server, as well as getting reward for top ranks.

> There are two type of leaderboard:

- Highscore: The standard leaderboard, each player has ONE highest score within the period.
- Score-sum: The leaderboard that summing up all scores reported by each player, e.g. seasonal event for collecting the most in-game items within the period.

> The web console is in the TODO list. Meanwhile, you will need to setup the leaderboards in the database manually.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Web Console](#web-console)
    - [Redeem Code Parameters](#redeem-code-parameters)
    - [Redeem Validator API](#redeem-validator-api)
    - [Unity Client Repo](#unity-client-repo)
- [TODO](#todo)
- [License](#license)

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

[](#installation)

Install this package via Composer:

```
$ composer require furic/leaderboards
```

> If you are using Laravel 5.5 or later, then installation is done. Otherwise follow the next steps.

#### Open `config/app.php` and follow steps below:

[](#open-configappphp-and-follow-steps-below)

Find the `providers` array and add our service provider.

```
'providers' => [
    // ...
    Furic\Leaderboards\LeaderboardsServiceProvider::class
],
```

Configuration
-------------

[](#configuration)

To create table for redeem codes in database run:

```
$ php artisan migrate
```

Usage
-----

[](#usage)

### Leaderboards Table

[](#leaderboards-table)

```
| Name            | Type      | Not Null |
|-----------------|-----------|----------|
| id              | integer   |     ✓    |
| game_id         | integer   |     ✓    |
| timescope       | tinyint   |     ✓    |
| sum_score       | boolean   |     ✓    |

```

Leaderboard settings, you would need to set up this mannually.

- Game ID: Which game this leaderboard belongs to.
- Timescope: The repeating period of the leaderboard: 0: all time, 1 - daily, 2 - weekly, 3 - monthly.
- Sum Score: Should we sum the scores for this leaderboard, set to true only if this is a "Score-sum Leaderboard".

### Leaderboard Timescopes Table

[](#leaderboard-timescopes-table)

```
| Name            | Type      | Not Null |
|-----------------|-----------|----------|
| id              | integer   |     ✓    |
| leaderboard_id  | integer   |     ✓    |
| start_at        | date      |     ✓    |
| end_at          | date      |     ✓    |
| previous_id     | integer   |          |

```

Leaderboard Timescopes are the entries for each leaderboard period, for example, a daily leaderboard will have one entry per day. Each entry is created automatically when the first player report score in a new period.

- Leaderboard ID: Which leaderboard this leaderboard timescope belongs to.
- Start At: The date that this leaderboard timescope start.
- End At: The date that this leaderboard timescope end.
- Previous ID: The previous leaderboard timescope ID, used to give the ranking reward of last period.

### Leaderboard Scores Table

[](#leaderboard-scores-table)

```
| Name                     | Type      | Not Null |
|--------------------------|-----------|----------|
| id                       | integer   |     ✓    |
| leaderboard_timescope_id | integer   |     ✓    |
| player_id                | integer   |     ✓    |
| score_sum                | integer   |     ✓    |
| highscore                | integer   |     ✓    |

```

Leaderboard Scores are the score entries of the players within the leaderboard timescope period. Each entry is created automatically when the player report score.

- Leaderboard Timescope ID: Which leaderboard time scope this leaderboard score belongs to.
- Player ID: Which player this leaderboard score belongs to.
- Score Sum: The score sum of this leaderboard score, used for score-sum leaderboard only.
- Highscore: The highscore of this leaderboard score, used for highscore leaderboard only.

### Leaderboard Rewards Table

[](#leaderboard-rewards-table)

```
| Name            | Type      | Not Null |
|-----------------|-----------|----------|
| id              | integer   |     ✓    |
| leaderboard_id  | integer   |     ✓    |
| score_sum       | integer   |          |
| score_sum_rank  | integer   |          |
| highscore_rank  | integer   |          |
| type            | tinyint   |     ✓    |
| amount          | integer   |     ✓    |
| item_id         | integer   |          |

```

Leaderboard Rewards are the rewards for players achriving given rank or score sum, optional only if you have rewards for leaderboard and you would need to set up this mannually.

- Leaderboard ID: Which leaderboard this leaderboard reward belongs to.
- Score Sum: The score sum required for this reward, for example, 100 coins for collecting 5 candies in game.
- Score Sum Rank: The score sum rank required for this reward, for example, 100 coins for 5 most collected players.
- Highscore Rank: The highscore rank required for this reward, for example, 100 coins for 5 top score players.
- Type: The reward item type.
- Amount: The reward item amount.
- Item ID: The reward item ID, optional. Notes: Only one number would be set within Score Sum, Score Sum Rank and Highscore Rank; the rest two should be null. The lower ranks would ignore the higher ranks, for example entries of 5 rank and 10 rank, the 10 rank entry would ignore the first 5 rank and only giving reward for rank 5~10.

### Leaderboard Player Rewards Table

[](#leaderboard-player-rewards-table)

```
| Name                     | Type      | Not Null |
|--------------------------|-----------|----------|
| id                       | integer   |     ✓    |
| leaderboard_timescope_id | integer   |     ✓    |
| player_id                | integer   |     ✓    |
| score_sum                | integer   |     ✓    |
| score_sum_rank           | integer   |     ✓    |
| highscore_rank           | integer   |     ✓    |

```

Leaderboard Player Rewards are the reward entries for each player. Each entry is created automatically when the player obtain a reward.

- Leaderboard Timescope ID: Which leaderboard time scope this leaderboard player reward belongs to.
- Player ID: Which player this leaderboard player reward belongs to.
- Score Sum: The score sum that the player achived, used for score-sum leaderboard only.
- Score Sum Rank: The score sum ranking that the player achived, used for score-sum leaderboard only.
- Highscore: The highscore that the player achived, used for highscore leaderboard only.

### API URLs

[](#api-urls)

GET `/api/leaderboards`Returns a JSON array containing all valid leaderboards, for debug purpose only.

GET `/api/leaderboards/{id}`Returns a JSON data containing the leaderboards with given ID, for debug purpose only.

GET `/api/leaderboards/{id}/current`Returns a JSON data containing the current leaderboard timescope and reward info.

GET `/api/leaderboards/{id}/score-sums`Returns a JSON array containing all score-sum entries around the player's score-sum entry.

GET `/api/leaderboards/{id}/highscores`Returns a JSON array containing all highscore entries around the player's highscore entry.

GET `/api/leaderboards/{id}/rewards`Returns a JSON data containing all rewards the player can be obtained in current (score-sum) and previous (rank) leaderboard timescope period.

POST `/api/leaderboards/{id}/score`Reports a score of the player and creates the relevant database entries.

POST `/api/leaderboards/{id}/reward`Reports a reward obtain of the player and creates the relevant database entries.

API Document can be found [here](https://documenter.getpostman.com/view/2560814/TVmV6tm8#4b1f48ab-8d8a-4c6c-a19c-3fa7ae1cd371).

### Unity Client Repo

[](#unity-client-repo)

You can simply import this repo in Unity to communicate with your Laravel server with this package: ``

TODO
----

[](#todo)

- Create the web console to add/edit leaderboards and upload images.
- Add admin login for web console.
- Add tests and factories.

Alternative Solutions
---------------------

[](#alternative-solutions)

Before you start running and developing your Laravel server, you should always consider other leaderboard solutions first:

- (Mobile only) App Game Center and Google Play Games leaderboards: highly recommendated for mobile games but not cross-platform and the control such as removing hacker scores is limited.
- [dreamlo](http://dreamlo.com): A free cross-platform leaderboard service, also limited control.
- [GameSparks](https://www.gamesparks.com)/[Playfab](https://www.playfab.com) Full game server services including leaderboards, great for mid-core games but require good javascript and daabase knowledge.

License
-------

[](#license)

laravel-leaderboards is licensed under a [MIT License](https://github.com/furic/laravel-leaderboards/blob/main/LICENSE).

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~10 days

Total

3

Last Release

1926d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/44884321?v=4)[Richard Fu](/maintainers/furic)[@furic](https://github.com/furic)

---

Top Contributors

[![furic](https://avatars.githubusercontent.com/u/44884321?v=4)](https://github.com/furic "furic (8 commits)")

---

Tags

scorerankingdailymonthlyleaderboardsleaderboardweeklyhighscore

### Embed Badge

![Health badge](/badges/furic-leaderboards/health.svg)

```
[![Health](https://phpackages.com/badges/furic-leaderboards/health.svg)](https://phpackages.com/packages/furic-leaderboards)
```

###  Alternatives

[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

2.9k34.0M112](/packages/darkaonline-l5-swagger)[echolabsdev/prism

A powerful Laravel package for integrating Large Language Models (LLMs) into your applications.

2.3k388.3k10](/packages/echolabsdev-prism)[sburina/laravel-whmcs-up

WHMCS API client and user provider for Laravel

271.3k](/packages/sburina-laravel-whmcs-up)

PHPackages © 2026

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