PHPackages                             zelenin/elo - 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. zelenin/elo

AbandonedArchivedLibrary

zelenin/elo
===========

A PHP implementation of Elo rating system

0.0.1(11y ago)257.8k↓34.6%62MITPHPPHP &gt;=5.3.0

Since Jun 17Pushed 11y ago2 watchersCompare

[ Source](https://github.com/zelenin/elo)[ Packagist](https://packagist.org/packages/zelenin/elo)[ Docs](https://github.com/zelenin/elo)[ RSS](/packages/zelenin-elo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (2)

Elo
===

[](#elo)

A PHP implementation of [Elo rating system](http://en.wikipedia.org/wiki/Elo_rating_system)

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

[](#installation)

### Composer

[](#composer)

The preferred way to install this extension is through [Composer](http://getcomposer.org/).

Either run

```
php composer.phar require zelenin/elo "dev-master"

```

or add

```
"zelenin/elo": "dev-master"

```

to the require section of your `composer.json`

Usage
-----

[](#usage)

Create two players with current ratings:

```
use Zelenin\Elo\Player;

$player1 = new Player(1200);
$player2 = new Player(800);
```

Create match:

```
use Zelenin\Elo\Match;

$match = new Match($player1, $player2);
$match->setScore(1, 0)
    ->setK(32)
    ->count();
```

Get players:

```
$player1 = $match->getPlayer1();
$player2 = $match->getPlayer2();
```

Get new ratings:

```
$newRating1 = $player1->getRating();
$newRating2 = $player2->getRating();
```

### Advanced usage

[](#advanced-usage)

If you want use this library for not-traditional for Elo sports like football, ice hockey, basketball, you may set additional handlers for setting goal index and home correction.

```
use Zelenin\Elo\Match;
use Zelenin\Elo\Player;

$player1 = new Player(1200);
$player2 = new Player(800);

$goalIndexHandler = function ($score1, $score2) {
    $diff = abs($score1 - $score2);
    if ($diff > 0) {
        return sqrt($diff);
    }
    return 1;
};

$homeCorrectionHandler = function ($home, $diff) {
    $coefficient = 100;
    if ($home == 1) {
        return $diff - $coefficient;
    }
    if ($home == 2) {
        return $diff + $coefficient;
    }
    return $diff;
};

$match = new Match($player1, $player2);
$match->setScore(1, 0)
    ->setK(32)
    ->setGoalIndexHandler($goalIndexHandler)
    ->setHome(2)
    ->setHomeCorrectionHandler($homeCorrectionHandler)
    ->count();

$newRating1 = $player1->getRating();
$newRating2 = $player2->getRating();
```

Info
----

[](#info)

See Wiki about [Elo rating system](http://en.wikipedia.org/wiki/Elo_rating_system)

Author
------

[](#author)

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

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

4354d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0de51e0d5cd7141a2189ae926d4a3c449d5d41fda7c6b63b08869eb3c1e53b9a?d=identicon)[zelenin](/maintainers/zelenin)

---

Top Contributors

[![zelenin](https://avatars.githubusercontent.com/u/1427885?v=4)](https://github.com/zelenin "zelenin (7 commits)")

---

Tags

Ratingrankingelo

### Embed Badge

![Health badge](/badges/zelenin-elo/health.svg)

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

###  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)
