matchtime / season-generator
A league-season match generator, installable as a package and as used on https://matchtime.uk
Requires (Dev)
- phpunit/phpunit: ~4.0
- squizlabs/php_codesniffer: 2.*
This package is not auto-updated.
Last update: 2016-11-02 16:34:28 UTC
README
A league-season match generator, installable as a package and as used on MatchTime.uk
Installation
To install the package add the require to your composer.json
require: {
"matchtime/season-generator": "dev-master"
}
Then do a composer install.
Usage
To use this package ....
- use the namespace in your class
MatchTime\SeasonGenerator\Generator
- $generator = new Generator($options);
- $generator->generateSeason();
Options
Options must be passed to enable the generator to create the matches.
Required Options: 'first_match', 'teams',
Here is an example options array
$options = [
'first_match' => '2015-05-06',
'teams' => [1, 2, 6, 7, 9, 12],
'games_per_team' => 2,
'gap_every' => 0,
'gap_duration' => 1,
'team_conflicts' => [[1,2]]
];
FAQ
Q: How are the matches generated.
A: Please feel free to check the code, but essentially, each team is divided into home/away (which is swapped after each week). Teams matchup's are added to the seasons teams_played array to prevent same teams playing twice in each half-season.