Use the classic ELO ranking algorithm
$27.00
Add a complete ELO ranking system to your Laravel application with just one command. Perfect for competitive games, tournaments, photo contests, and any ranking system.
php artisan cook:326166428473917440
The recipe will guide you through setup with interactive prompts for your model names and preferences.
// Add traits to your models
class Player extends Model
{
use \App\Concerns\Rating\HasElo; // Add to rankable models
}
class Tournament extends Model
{
use \App\Concerns\Rating\HasEloRanking; // Add to parent models
}
// Get two players for voting
[$player1, $player2] = $tournament->getTwoAppropriateRankableItems();
// Record a result
$vote = Vote::create([
'tournament_id' => $tournament->id,
'winner_id' => $player1->id,
'loser_id' => $player2->id,
]);
$vote->process(); // Updates both scores
// Get rankings
$leaderboard = $tournament->getLeaderboard();
$playerScore = $player->getEloScore();
$playerRank = $player->getRankingPosition();
The ELO algorithm is the gold standard for competitive ranking systems, used by chess federations, gaming platforms, and sports leagues worldwide.
124 ratings
[]
[]
We don't have any pairings for this recipe yet.