sharapov/odds-converter

Convert odds between american, decimal, and fractional formats

1.01 2017-05-14 14:37 UTC

This package is auto-updated.

Last update: 2024-10-29 04:59:18 UTC


README

Convert odds between american, decimal, and fractional formats

Installation

You can either get the files from GIT or you can install the library via Composer. To use Composer, simply add the following to your composer.json file.

{
    "require": {
        "sharapov/odds-converter": "1.01"
    }
}

How to use it?

require_once "../vendor/autoload.php";

$converter = new \Sharapov\OddsConverter\OddsConverter($odd);

Set up your input odd in the decimal, fractional or moneyline (US) format

Set moneyline (US) input

$converter->setOdd('275');
Get fractional
print $converter->getFractional(); // 11/4
Get decimal
print $converter->getDecimal(); // 3.75

Set fractional input

$converter->setOdd('11/4');
Get moneyline (US)
print $converter->getMoneyline(); // 275
Get decimal
print $converter->getDecimal(); // 3.75

Set decimal input

$converter->setOdd('3.75');
Get moneyline (US)
print $converter->getMoneyline(); // 275
Get fractional
print $converter->getFractional(); // 11/4

That's so easy