Download the PHP package astronati/fantasy-football-calculator without Composer
On this page you can find all versions of the php package astronati/fantasy-football-calculator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download astronati/fantasy-football-calculator
More information about astronati/fantasy-football-calculator
Files in astronati/fantasy-football-calculator
Package fantasy-football-calculator
Short Description This library allows user to calculate the points/magic points that a team has reached after a soccer match. The total can be altered through some bonus like the defense one.
License MIT
Informations about the package fantasy-football-calculator
Fantasy Football Calculator
This library allows user to calculate the points that a team has reached after a soccer match. The total can be altered through some bonus like the defense one.
Installation
You can install the library and its dependencies using composer
running:
Usage
The library returns a result:
- A MatchResult when a fantasyteam is against another one
- A simple Result when a fantasyteam plays against all others
Rules
Calculator can be configured with different rules in order to apply different bonus/malus to the final result. Rules can be applied to a single team or in a match context: take a look at following folders to see which bonus are supported:
Each rule can be added to the Calculator configuration as shown in the example as follows.
NOTE: To request another rule please file a new issue.
Formation and Footballers
Calculator needs one or two formations: so developer has to provide Formation instances.
NOTE Footballer abstract class needs to be extended by developer that has to set the code property. The code property is the one provided by the Quotation(s) instances.
Take a look at the Footballer class that has been implemented in the example folder.
Example
A couple of examples are provided in order to figure out better how this library can be integrated in the own system.
Match Result
The following snippet is extracted from the example/sample.php file and shows how configuring a calculator in a match.
Result
The following snippet is extracted from the example/sample.php file and shows how configuring a calculator when a fantasyteam plays alone or against all others.
Development
The environment requires phpunit, that has been already included in the dev-dependencies
of the
composer.json
.
Dependencies
To install all modules you just need to run following command:
Testing
Tests files are created in dedicates folders that replicate the src structure as follows:
Execute following command to run the tests suite:
Run what follows to see the code coverage:
License
This package is released under the MIT license.