PHPackages                             laxity7/glicko2 - 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. laxity7/glicko2

ActiveLibrary

laxity7/glicko2
===============

A PHP implementation of glicko2 rating system

1.1.0(2y ago)11241MITPHPPHP ^7.4|^8.0

Since May 2Pushed 2y agoCompare

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

READMEChangelog (1)Dependencies (1)Versions (5)Used By (0)

Glicko2 rating system
=====================

[](#glicko2-rating-system)

[![License](https://camo.githubusercontent.com/7ff10e5c6e930793002745d791c5a8122c6db9ae250ea9a26b3fdec65703b89d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c6178697479372f676c69636b6f322e737667)](https://github.com/laxity7/glicko2/blob/master/LICENSE)[![Latest Stable Version](https://camo.githubusercontent.com/428da5c9805ce6f596fdcd7e6892514c8221a562bc773e7945360ded5fd4d034/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6178697479372f676c69636b6f322e737667)](https://packagist.org/packages/laxity7/glicko2)[![Total Downloads](https://camo.githubusercontent.com/528f9e67592656721285417b2c2b3c1584c3aca41f5e8a27bebcf55704bb1fb4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6178697479372f676c69636b6f322e737667)](https://packagist.org/packages/laxity7/glicko2)

A PHP implementation of [Glicko2 rating system](http://www.glicko.net/glicko.html)

The Glicko2 rating system is a popular algorithm used to calculate the skill levels of players in various competitive games. It takes into account both the player's performance and the strength of their opponents, providing more accurate and up-to-date ratings compared to traditional methods like Elo. The system uses a logarithmic function that adjusts a player's rating based on the outcome of their matches, with higher-skilled players having a greater impact on their opponent's ratings. Glicko2 also employs a confidence interval and a smoothing parameter to further refine the accuracy and stability of the rankings.

The Glicko2 rating system is an advanced Elo system that was used in Mark Zuckerberg's infamous Facemash website

Supports PHP versions 7.4 and 8.\*

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

[](#installation)

For installation via Composer run:

`composer require laxity7/glicko2`

Usage
-----

[](#usage)

For example, you have a table in the database with the following fields:

```
use laxity7\glicko2\Player;
use App\UserRating;

class UserRating
{
    public int $user_id;
    public float $rating;
    public float $rating_deviation;
    public float $rating_volatility;
}

class Repository
{
    public function getUserRating(int $userId)
    {
        $userRating = $this->findInDbFromId($userId);
        if (!$userRating) {
            $userRating = $this->createUserRating($userId);
        }
        return $userRating;
    }

    public function createUserRating(int $userId)
    {
        $player = new Player();
        $userRating = new UserRating();
        $userRating->user_id = $userId;
        $userRating->rating = $player->getRating();
        $userRating->rating_deviation = $player->getRatingDeviation();
        $userRating->rating_volatility = $player->getRatingVolatility();

        $this->saveToDb($userRating);

        return $userRating;
    }

    public function updateRating(int $userId, Player $player)
    {
        $userRating = $this->getUserRating($userId);
        $userRating->rating = $player->getRating();
        $userRating->rating_deviation = $player->getRatingDeviation();
        $userRating->rating_volatility = $player->getRatingVolatility();

        $this->saveToDb($userRating);
    }
}
```

Ok, preparation completed, lets play

```
use laxity7\glicko2\MatchGame;
use laxity7\glicko2\MatchCollection;
use laxity7\glicko2\Player;

$repository = new Repository();

$userRating1 = $repository->getUserRating(1);
$userRating2 = $repository->getUserRating(2);

$player1 = new Player($userRating1->rating, $userRating1->rating_deviation, $userRating1->rating_volatility);
$player2 = new Player($userRating2->rating, $userRating2->rating_deviation, $userRating2->rating_volatility);
//$player2 = new Player(); available defaults for new player

// match chain
$match1 = new MatchGame($player1, $player2, 1, 0);
$match1->calculate(); // The calculation method does not return anything, it only calculates and changes the rating of players

$match2 = new MatchGame($player1, $player2, 3, 2);
$match2->calculate();

// or match collection
$matchCollection = new MatchCollection();
$matchCollection->addMatch(new MatchGame($player1, $player2, 1, 0));
$matchCollection->addMatch(new MatchGame($player1, $player2, 3, 2));
$matchCollection->calculate();

// just get a new ratings
$newPlayer1Rating = $player1->getRating();
$newPlayer2Rating = $player2->getRating();

// for example, save to the database
$repository->updateRating(1, $player1);
$repository->updateRating(2, $player2);
```

Author
------

[](#author)

[Aleksandr Zelenin](https://github.com/zelenin/), e-mail:

[Vlad Varlamov](https://github.com/laxity7/), e-mail:

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~901 days

Total

4

Last Release

956d ago

PHP version history (3 changes)1.0.0PHP &gt;=5.4.0

1.0.1PHP &gt;=7.1.0

1.1.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a9b526de35a63bf1110afac0fd4273cd7ae65b360a56504364ff06c1c5ffc533?d=identicon)[laxity7](/maintainers/laxity7)

---

Top Contributors

[![laxity7](https://avatars.githubusercontent.com/u/6792144?v=4)](https://github.com/laxity7 "laxity7 (5 commits)")[![zelenin](https://avatars.githubusercontent.com/u/1427885?v=4)](https://github.com/zelenin "zelenin (4 commits)")[![pelmered](https://avatars.githubusercontent.com/u/680058?v=4)](https://github.com/pelmered "pelmered (3 commits)")

---

Tags

Ratingrankingglickoglicko2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laxity7-glicko2/health.svg)

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

###  Alternatives

[rubix/ml

A high-level machine learning and deep learning library for the PHP language.

2.2k1.4M28](/packages/rubix-ml)[kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

1.1k4.5M5](/packages/kartik-v-bootstrap-star-rating)[gabrielbull/ups-api

PHP UPS API

4642.4M10](/packages/gabrielbull-ups-api)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[multicaret/laravel-acquaintances

This light package, with no dependencies, gives Eloquent models the ability to manage friendships (with groups), verifications, and interactions such as: Likes, favorites, votes, subscribe, follow, ..etc. And it includes advanced rating system.

851266.9k2](/packages/multicaret-laravel-acquaintances)[willvincent/laravel-rateable

Allows multiple models to be rated with a fivestar like system.

416452.0k3](/packages/willvincent-laravel-rateable)

PHPackages © 2026

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