chafficui/elevenelo
Composer 安装命令:
composer require chafficui/elevenelo
包简介
PHP client for the 11elo Soccer ELO API
README 文档
README
PHP client for the 11elo Soccer ELO API — live and historical Elo ratings for German football (Bundesliga, 2. Bundesliga, 3. Liga).
Requires PHP 8.1+ and the built-in curl and json extensions (enabled by default).
Installation
composer require chafficui/elevenelo
Quick start
<?php require 'vendor/autoload.php'; $client = new \ElevenElo\Client('11e_fre_your_key_here'); // List all teams $teams = $client->getTeams(); foreach ($teams as $team) { echo $team['teamName'] . ' ' . $team['currentElo'] . PHP_EOL; } // Get detailed info for one team $team = $client->getTeam('Bayern München'); echo $team['team']['currentElo'] . PHP_EOL; // Upcoming matches $upcoming = $client->getUpcomingMatches(league: 'BL1', limit: 10); foreach ($upcoming as $match) { echo $match['homeTeam'] . ' vs ' . $match['awayTeam'] . PHP_EOL; }
Getting an API key
Register for free at https://www.11elo.com/docs.
Keys follow the format 11e_<tier>_<hex> and are sent via the X-API-Key request header (handled automatically by this client).
Rate limits by tier:
| Tier | Requests / day |
|---|---|
| Free | 100 |
| Basic | 1,000 |
| Pro | 10,000 |
API reference
new Client(apiKey, baseUrl, timeout)
| Parameter | Default | Description |
|---|---|---|
$apiKey |
— | Your 11elo API key (required) |
$baseUrl |
https://api.11elo.com |
Override for self-hosted / local dev |
$timeout |
30 |
HTTP request timeout in seconds |
Teams
getTeams(): array
Returns all teams with current ELO stats, league info and trend data.
$teams = $client->getTeams(); // [['teamName' => 'Bayern München', 'currentElo' => 1847, 'league' => 'BL1', ...], ...]
getTeam(string $teamName): array
Full detail for one team — ELO history, recent form, upcoming matches, career stats.
$team = $client->getTeam('Borussia Dortmund'); // ['team' => [...], 'eloHistory' => [...], 'recentForm' => [...], 'upcomingMatches' => [...]]
getHeadToHead(string $team1, string $team2): array
Historical head-to-head match results between two teams.
$h2h = $client->getHeadToHead('Bayern München', 'Borussia Dortmund'); // [['date' => '2026-02-15', 'result' => '2:1', 'winner' => 'Bayern München', ...], ...]
Matches
getMatches(?string $season, ?string $fromDate, ?string $toDate, ?int $limit, ?int $offset): array
Paginated match history. All parameters are optional.
$matches = $client->getMatches(season: '2024/2025', limit: 50); // [['homeTeam' => 'Bayern München', 'awayTeam' => 'BVB', 'homeElo' => 1835, ...], ...]
getUpcomingMatches(?string $league, ?string $sort, ?int $limit): array
Upcoming fixtures with ELO-difference predictions.
$upcoming = $client->getUpcomingMatches(league: 'BL1', limit: 20); // [['homeTeam' => '...', 'awayTeam' => '...', 'eloDiff' => 40, ...], ...]
getMatch(int|string $matchId): array
Full detail for a single match.
$match = $client->getMatch(12345); // ['match' => [...], 'homeRecentForm' => [...], 'awayRecentForm' => [...], ...]
Seasons
getSeasons(): array
List all available seasons and the most recent one.
$data = $client->getSeasons(); // ['seasons' => ['2025/2026', '2024/2025', ...], 'latestSeason' => '2025/2026']
getSeason(string $season, ?string $league): array
Per-team ELO change statistics for a given season.
$entries = $client->getSeason('2024/2025', league: 'BL1'); // [['teamName' => 'Bayern München', 'startElo' => 1820, 'endElo' => 1847, 'change' => 27, ...], ...]
Comparison
getComparisonHistory(array $teams): array
Time-series ELO data for multiple teams in one call. $teams must contain at least two names.
$history = $client->getComparisonHistory(['Bayern München', 'Borussia Dortmund']); // [ // 'Bayern München' => [['Date' => 1709856000000, 'ELO' => 1847], ...], // 'Borussia Dortmund' => [['Date' => 1709856000000, 'ELO' => 1720], ...], // ]
Error handling
All exceptions extend \ElevenElo\Exception\ElevenEloException.
| Exception | When thrown |
|---|---|
AuthenticationException |
API key is missing or invalid (HTTP 401) |
RateLimitException |
Daily quota exceeded (HTTP 429) |
NotFoundException |
Resource does not exist (HTTP 404) |
ApiException |
Any other non-2xx response; $statusCode is set |
use ElevenElo\Client; use ElevenElo\Exception\AuthenticationException; use ElevenElo\Exception\NotFoundException; use ElevenElo\Exception\RateLimitException; $client = new Client('11e_fre_your_key_here'); try { $team = $client->getTeam('Unknown FC'); } catch (NotFoundException $e) { echo 'Team not found' . PHP_EOL; } catch (RateLimitException $e) { echo 'Rate limit hit, resets at ' . $e->resetAt . PHP_EOL; } catch (AuthenticationException $e) { echo 'Bad API key' . PHP_EOL; }
License
MIT
chafficui/elevenelo 适用场景与选型建议
chafficui/elevenelo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「client」 「elo」 「soccer」 「football」 「bundesliga」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 chafficui/elevenelo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 chafficui/elevenelo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 chafficui/elevenelo 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Implementation of Microsoft's TrueSkill matchmaking system for PHP
A PSR-7 compatible library for making CRUD API endpoints
Mock PSR-18 HTTP client
Asynchronous MQTT client built on React
Moip integration with Magento 2
Client for Google Directions API to add interpolated points to a route consisting of given coordinates.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-13