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

ActiveLibrary

alcalyn/elo
===========

Elo system with a reliability purpose

v1.0(11y ago)66471MITPHP

Since Nov 26Pushed 9y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (4)Used By (0)

Elo system
==========

[](#elo-system)

Another **Elo** implementation in **PHP** ! But this one introduce a **reliability** purpose.

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/de0a2018618ecd49e46871a109d68427a66e1cda697d574917143d32270ed0f3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616c63616c796e2f656c6f2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/alcalyn/elo/?branch=master)[![Build Status](https://camo.githubusercontent.com/389cd16955a51431e4b11438edd01bf83539877647437c1fca45fc101aec1032/68747470733a2f2f7472617669732d63692e6f72672f616c63616c796e2f656c6f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/alcalyn/elo)[![License](https://camo.githubusercontent.com/5a36c86eeea072b94308eac30c36bc892cc844da37ee562b9e668ffd34dccdb9/68747470733a2f2f706f7365722e707567782e6f72672f616c63616c796e2f656c6f2f6c6963656e73652e737667)](https://packagist.org/packages/alcalyn/elo)

Reliability purpose
-------------------

[](#reliability-purpose)

**A history**: You have a good player **A** which played many games and have a score of **2100 Elo**. A new player **B** subscribe to the game website, so his Elo score is initialized to **1500**. But in fact, he is a very good player, better than **A**, and beat him like crushing an ant.

**The problem**: New player **B** will win many Elo because he won against a **2100 Elo** player. That's ok. But player **A** (**2100 Elo**) will lose many Elo because he lost against a **1500 Elo** player, but in fact strongest.

The fact is that the **new player Elo score is not reliable**, so it should not impact others players Elo scores.

**The solution**: This library. It introduces a **reliability coefficient** (decimal between 0.0 and 1.0) for Elo A and Elo B.

Composer
--------

[](#composer)

Install via composer

```
{
    "require": {
        "alcalyn/elo": "1.x"
    }
}
```

*Or download the library manually if you don't use composer.*

Usage
-----

[](#usage)

- Instantiate a standard Elo system

```
use Alcalyn/Elo/EloSystem;

$eloSystem = new EloSystem();
```

- Calculate updated Elo scores from old Elo

```
/**
 * A player with 1650 Elo beat another with 1920
 */
$updatedElos = $eloSystem->calculate(1650, 1920, 1);

print_r($updatedElos);
/* Output:
    Array
    (
        [0] => 1663.2084157978
        [1] => 1906.7915842022
    )
*/
```

- Set **reliability** coefficient to Elo scores

```
/**
 * A player with 1907 Elo (1.0 reliability)
 * lose against a new player with 1500 (and reliability to 0.0)
 */
$updatedElos = $eloSystem->calculate(1907, 1500, 0, 1.0, 0.0);

print_r($updatedElos);
/* Output:
Array
(
    [0] => 1907
    [1] => 1514.5978664353
)
*/
```

- Using method aliases for win, lose or draw

```
/**
 * Method Aliases
 */
$elo->win(2100, 1500, 1.0, 0.0);
$elo->lose(2100, 1500, 1.0, 0.0);
$elo->draw(2100, 1500, 1.0, 0.0);
```

- Instanciate a system with a different K factor (default is 16)

```
/**
 * Use a different K factor in your Elo system
 */
$eloSystemK32 = new EloSystem(32);
```

Detailled examples
------------------

[](#detailled-examples)

**A new player**:

Player **A** has **2100 Elo**, reliability **1.0**
Player **B** has **1500 Elo**, reliability **0.0**

**A** wins: Expected result, so **B** loses a small amount of Elo, and **A** win nothing.
**B** wins: NOT expected result, so **B** wins a BIG amount of Elo, and **A** lose nothing.

**A** Elo score will not be updated when he plays versus a new player with an unreliable Elo score.

(*And new player* ***B*** *should have its Elo reliability increased by something like 1/10 after every games until his reliability reaches 1*)

```
$elo = new EloSystem();

/**
 * Result without reliability
 */
print_r($elo->lose(2100, 1500));

/* Output:
    Array
    (
        [0] => 2084.4904548805 // lose -16 Elo
        [1] => 1515.5095451195 // win  +16 Elo
    )
*/

/**
 * Result with reliability
 */
print_r($elo->lose(2100, 1500, 1.0, 0.0));

/* Output:
    Array
    (
        [0] => 2100 // don't lose Elo against new player
        [1] => 1515.5095451195 // win +16 Elo vs reliable Elo score
    )
*/
```

**Another example: two newbies players**:

Player **A** has **1500 Elo**, reliability **0.0**
Player **B** has **1500 Elo**, reliability **0.0**

There is two new players, so their reliabilities are both 0.0: **the algorithm takes them like if they were both 1.0**.

And if player **A** had an Elo reliability equal to **0.4**, and player **B** equal to **0.0**, the algorithm adds them **+0.6** so one of reliabilities reaches **1.0**.

License
-------

[](#license)

This project is under [MIT Lisense](https://github.com/alcalyn/elo/blob/master/LICENSE)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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

4190d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/17f0c4d65197a7aed6ecc8fdedd5a097c7238c9be19aca08c92c05d38fd8c29e?d=identicon)[alcalyn](/maintainers/alcalyn)

---

Top Contributors

[![alcalyn](https://avatars.githubusercontent.com/u/1588144?v=4)](https://github.com/alcalyn "alcalyn (18 commits)")

---

Tags

phpelo

### Embed Badge

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

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

###  Alternatives

[pestphp/pest-plugin-stressless

Stressless plugin for Pest

67792.6k16](/packages/pestphp-pest-plugin-stressless)

PHPackages © 2026

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