boraguler / round-robin
RoundRobin for Laravel 5.8+ and above...
Installs: 36
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/boraguler/round-robin
Requires
- php: >=7.1.3 <9.0
- laravel/framework: >=5.8 <13.0
Requires (Dev)
- orchestra/testbench: 3.8.x
- phpunit/phpunit: ^7.5
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.phpand add the following to theprovidersarray:
BoraGuler\RoundRobin\RoundRobinServiceProvider::class,
- Open your
config/app.phpand add the following to thefacadesarray:
'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.