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

ActiveLibrary

avoo/elo
========

Elo calculator library

0.2.0(10y ago)01001MITPHPPHP &gt;=5.3.3

Since Oct 1Pushed 10y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (3)Used By (1)

Elo
===

[](#elo)

[!\[Build Status\] (https://scrutinizer-ci.com/g/avoo/Elo/badges/build.png?b=master)](https://scrutinizer-ci.com/g/avoo/Elo/build-status/master)[!\[Scrutinizer Code Quality\] (https://scrutinizer-ci.com/g/avoo/Elo/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/avoo/Elo/?branch=master)[!\[License\] (https://poser.pugx.org/avoo/elo/license.svg)](https://packagist.org/packages/avoo/elo)

This is a PHP library to calculate the Elo rank between two players.

Documentation
-------------

[](#documentation)

into your `composer.json` file:

```
{
    "require": {
        "avoo/elo": "~0.2"
    }
}
```

Default Usage
-------------

[](#default-usage)

You need to implement the class `Avoo\Elo\Model\EloPlayerInterface` on your own player class

```
use Avoo\Elo\Model\EloPlayerInterface;
use Avoo\Elo\Model\EloUserInterface;

class EloPlayer implements EloPlayerInterface
{
    /**
     * @var integer
     */
    protected $elo;

    /**
     * @var EloUserInterface $user
     */
    protected $user;

    /**
     * {@inheritdoc}
     */
    public function setElo($elo)
    {
        $this->elo = $elo;

        return $this;
    }

    /**
     * {@inheritdoc}
     */
    public function getElo()
    {
        return $this->elo;
    }

    /**
     * {@inheritdoc}
     */
    public function setUser(EloUserInterface $user)
    {
        $this->user = $user;

        return $this;
    }

    /**
     * {@inheritdoc}
     */
    public function getUser()
    {
        return $this->user;
    }

    //... Your own code
}
```

Consider the player A with 2300 elo and the player B 1800, the player A lose.

The default setup for winner is: - 0 Player A lose - 0.5 Draw - 1 Player A win

Example 1
---------

[](#example-1)

```
use Avoo\Elo\EloPoint;
use Avoo\Elo\EloVersusInterface;
use Avoo\Elo\EloAggregagtionInterface;

$eloCalculator = new EloPoint();

/** @var EloVersusInterface $match */
$eloPoint->calculate($match);

/** @var EloAggregationInterface $aggregation */
$aggregation = $eloPoint->getAggregation();
```

Example 2
---------

[](#example-2)

```
use Avoo\Elo\EloPoint;
use Avoo\Elo\EloVersusInterface;
use Avoo\Elo\EloAggregagtionInterface;

/** @var EloVersusInterface $match */
$eloCalculator = new EloPoint($match);
$eloPoint->calculate();

/** @var EloAggregationInterface $aggregation */
$aggregation = $eloPoint->getAggregation();
```

Override configuration
----------------------

[](#override-configuration)

You can override the default configuration for adjust your elo calculator

```
use Avoo\Elo\EloPoint;
use Avoo\Elo\EloVersusInterface;
use Avoo\Elo\EloAggregagtionInterface;
use Avoo\Elo\ConfigurationInterface;

/** @var ConfigurationInterface $configuration */
$configuration = new Configuration();

/**
 * Floor is the experience range calculator
 */
$configuration->setFloor(200);

/**
 * Base range is ratio number for calculate the new elo
 * In this case between 0 and 1700 elo point the range is 50, over it's 20
 * For example with 1500 elo point for both players, with 50 elo range, the new elo will be 18 and -18,
 * and for 20 elo range, the new elo will be 7 and -7
 */
$configuration->setBaseRange(array(
    0 => 50
    1700 => 20
));

/*
 * Base elo is the start elo point for a new player
 */
$configuration->setBaseElo(1000);

/** @var EloVersusInterface $match */
$eloCalculator = new EloPoint($match, $configuration);
$eloPoint->calculate();

/** @var EloAggregationInterface $aggregation */
$aggregation = $eloPoint->getAggregation();
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

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

Total

2

Last Release

3815d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b8ee83ffc36845dc3d1092cd98dbf56fc2cffd8e46b2d04b777959992cb60eb?d=identicon)[avoo](/maintainers/avoo)

---

Top Contributors

[![avoo](https://avatars.githubusercontent.com/u/6162605?v=4)](https://github.com/avoo "avoo (11 commits)")

---

Tags

rewardspointselorankcompetition

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[qcod/laravel-gamify

Add gamification in laravel app with reputation point and badges support

680347.0k1](/packages/qcod-laravel-gamify)[fof/gamification

Upvotes and downvotes for your Flarum community

4157.1k6](/packages/fof-gamification)[malenki/math

Library to deal with some mathematical stuff. Implemented or partially implemented mathematical concepts are: Complex number, Matrix, Normal distribution, Random, Angle, Random Complex, Descriptive Statistics, Parametric tests (Anova, Dependant t-Test) and Non-Parametric tests (Wilcoxon Signed-rank test, Wilcoxon-Mann-Whitney test, Kruskal-Wallis).

1624.9k](/packages/malenki-math)

PHPackages © 2026

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