PHP package for dealing with different formats of betting odds: decimal (European), fractional (British), and moneyline (American)
- Use classes of Decimal/fractional/moneyline odds
- Convert values of odds (all directions)
- PHP 7.1+
- Composer
- Require the package using Composer
composer require alexsabdev/odds
- Create an instance of any odd
require 'vendor/autoload.php';
use Alexsabdev\Odds\DecimalOdd;
...
$odd = new DecimalOdd(3.5);
- Show the value
/**
* Prints '3.5'
*/
$decimal = $odd->value();
print_r($decimal);
- Convert to other odds
/**
* Prints '5/2'
*/
$fractional = $odd->toFractional()->value();
print_r($fractional);
/**
* Prints '+250'
*/
$moneyline = $odd->toMoneyline()->value();
print_r($moneyline);
This is an open-sourced software licensed under the MIT license.