Download the PHP package elijahcruz12/glicko2 without Composer
On this page you can find all versions of the php package elijahcruz12/glicko2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download elijahcruz12/glicko2
More information about elijahcruz12/glicko2
Files in elijahcruz12/glicko2
Package glicko2
Short Description A modern PHP 8.4 implementation of the Glicko-2 rating system, and the only one on Glicko.net
License MIT
Informations about the package glicko2
glicko2
A modern PHP 8.4 implementation of Glicko-2, a rating system for competitive game ladders. Glicko-2 is a refinement of the well-known Elo rating system that adds the concepts of rating deviation, volatility, and rating decay.
This is a clean, ground-up rewrite targeting PHP 8.4, with full type safety, immutable value objects, and a stateless calculator. It implements the algorithm as described in the official Glicko-2 paper by Professor Mark E. Glickman (revised March 22, 2022), including the corrected Illinois algorithm for volatility convergence.
This library is linked to on the official Glicko-2 page as a reference implementation.
Requirements
- PHP 8.4+
Installation
Usage
Creating a player rating
For new players, use the default values. The tau system constant should be between
0.3 and 1.2 depending on the application, and must be determined by estimation or
experimentation. Smaller values prevent large swings in volatility.
Calculating updated ratings
Ratings are calculated at the end of a rating period — a collection of games treated
as having occurred simultaneously. The Glicko2 calculator is stateless and returns a
new Rating instance without mutating the original.
Players who did not compete
Pass an empty results array. The rating and volatility remain unchanged, but the RD increases to reflect growing uncertainty.
Outcomes
Serialization
Rating implements JsonSerializable and supports PHP's native serialize()/unserialize(),
making it suitable for storage in a database or use with Laravel Queues.
JSON
The derived internal properties mu and phi are excluded from serialization — they
are always recomputed from rating and rd on construction, so round-tripping through
JSON is lossless.
Native PHP serialization
Laravel
For storing a player's rating in a database column, a simple JSON cast works well:
For Laravel Queues, Rating can be passed directly as a job property — PHP's native
serialization handles it automatically.
Concepts
Rating (r) — The player's skill estimate. Defaults to 1500 for new players.
Rating Deviation (RD) — Uncertainty in the rating. High for new or inactive players,
lower for active players with consistent results. Defaults to 350.
Volatility (σ) — How erratic the player's performance is expected to be. Defaults
to 0.06.
System Constant (τ) — Constrains how much volatility can change per rating period.
Recommended range is 0.3–1.2. Defaults to 0.75.
Rating periods
Glicko-2 works best when each rating period contains a moderate number of games — ideally at least 10–15 per player. All games within a period are treated as simultaneous. The length of a rating period is left to the administrator's discretion.
Testing
Tests are written with PestPHP and cover the full algorithm against the numerical
example from the official Glicko-2 paper, including intermediate values for v, Δ,
and σ′, as well as serialization round-trips.
License
MIT