boraguler / round-robin
RoundRobin for Laravel 5.8+.
v1.0.3
2020-04-02 18:22 UTC
Requires
- php: ^7.1.3
- laravel/framework: 5.8.*
Requires (Dev)
- orchestra/testbench: 3.8.x
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2025-01-29 06:40:21 UTC
README
BoraGuler\Round-Robin is an easy way to create schedule with round-robin(rr) technique.
Installation
- In order to install BoraGuler\Round-Robin, just add the following to your composer.json. Then run
composer update
:
"boraguler/round-robin": "1.0.*"
or run composer require boraguler/round-robin
- Open your
config/app.php
and add the following to theproviders
array:
BoraGuler\RoundRobin\RoundRobinServiceProvider::class,
- Open your
config/app.php
and add the following to thefacades
array:
'RoundRobin' => boraguler\RoundRobin\RoundRobinFacade::class,
Controllers and etc
use BoraGuler\RoundRobin\RoundRobin;
Using (Examples)
Setuping (without Facade):
$teams = ['Galatasaray', 'Arsenal', 'Atlético de Madrid', 'Borussia', 'Barcelona','Liverpool', 'Bayer 04', 'Real Madrid']; $schedule = new RoundRobin($teams)->make(); // or with 'from' static method $schedule = RoundRobin::from($teams)->make();
With a facade:
$teams = ['Galatasaray', 'Arsenal', 'Atlético de Madrid', 'Borussia', 'Barcelona','Liverpool', 'Bayer 04', 'Real Madrid']; $schedule = RoundRobin::from($teams)->make();
Generate a schedule without randomly shuffling the teams using the $shuffle boolean parameter:
$teams = ['Galatasaray', 'Arsenal', 'Atlético de Madrid', 'Borussia', 'Barcelona','Liverpool', 'Bayer 04', 'Real Madrid']; $schedule = RoundRobin::from($teams)->doNotShuffle()->make();
Use your own seed with the $seed integer parameter for predetermined shuffling:
$teams = ['Galatasaray', 'Arsenal', 'Atlético de Madrid', 'Borussia', 'Barcelona','Liverpool', 'Bayer 04', 'Real Madrid']; $schedule = RoundRobin::from($teams)->shuffle(15)->make();
If you want to pre-define round number (default = 1):
$teams = ['Galatasaray', 'Arsenal', 'Atlético de Madrid', 'Borussia', 'Barcelona','Liverpool', 'Bayer 04', 'Real Madrid']; $schedule = RoundRobin::from($teams)->rounds(3)->make();
If you want a double Round-robin:
$teams = ['Galatasaray', 'Arsenal', 'Atlético de Madrid', 'Borussia', 'Barcelona','Liverpool', 'Bayer 04', 'Real Madrid']; $schedule = RoundRobin::from($teams)->doubleRoundRobin()->make();
If you want a get a Schedule Object:
$teams = ['Galatasaray', 'Arsenal', 'Atlético de Madrid', 'Borussia', 'Barcelona','Liverpool', 'Bayer 04', 'Real Madrid']; $schedule = RoundRobin::from($teams)->makeSchedule();
License
BoraGuler Round-Robin is free software distributed under the terms of the MIT license.