Skip to content

praetoriantechnology/odds-formatter

Repository files navigation

odds Build Status

PHP package for dealing with different formats of betting odds: decimal (European), fractional (British), and moneyline (American)

Features

  • Use classes of Decimal/fractional/moneyline odds
  • Convert values of odds (all directions)

Requirements

  • PHP 7.1+
  • Composer

Installation

  • Require the package using Composer
composer require alexsabdev/odds

Usage

  • 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);

License

This is an open-sourced software licensed under the MIT license.

About

Tools for conversions of igaming odds formats.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages