philicevic/berger
Composer 安装命令:
composer require philicevic/berger
包简介
A tool to create round robin tournament matchups using the Berger tables
README 文档
README
This package allows you to generate round robin tournament matchups based on the Berger tables.
Usage
use Philicevic\Berger\Services\RoundRobin;
// this creates 6 rounds where teams play each other twice
$teams = ['A', 'B', 'C', 'D'];
$matchesAgainstEachOther = 2;
$rounds = RoundRobin::makeFromTeams($teams, $matchesAgainstEachOther);
// or use it step by step
$teams = ['A', 'B', 'C', 'D'];
$rr = RoundRobin::create();
$rr->setTeams($teams);
$rounds = $rr->make();
$rounds will be an array of Round objects.
Round
foreach ($rounds as $round) {
// get array of fixtures
$round->fixtures;
// get number of round
$round->number;
// add fixture to round
$round->addFixture($fixture);
// remove fixture from round by index
$round->removeFixture($index);
// format round as array
$round->toArray();
}
// $round->toArray() will return something like this
[
[
[
'home' => 'A',
'away' => 'C',
'round' => 1,
],
[
'home' => 'B',
'away' => 'D',
'round' => 1,
],
],
[
[
'home' => 'C',
'away' => 'B',
'round' => 2,
],
[
'home' => 'D',
'away' => 'A',
'round' => 2,
],
],
[
[
'home' => 'A',
'away' => 'B',
'round' => 3,
],
[
'home' => 'C',
'away' => 'D',
'round' => 3,
],
],
]
Fixture
Every fixture has two properties.
$fixture->home
$fixture->away
Both contain just the name of the team.
You could also access the teams via the getTeams method.
// returns ["Team A", "Team B"]
$fixture->getTeams()
If you want to swap the places of the teams for a fixture you can also do that.
$fixture->swapTeams()
philicevic/berger 适用场景与选型建议
philicevic/berger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 11 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 philicevic/berger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 philicevic/berger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-21