https://github.com/sharapov-outsource/odds-converter
Convert odds between american, decimal, and fractional formats
https://github.com/sharapov-outsource/odds-converter
conversion formulas odds php sports
Last synced: about 1 year ago
JSON representation
Convert odds between american, decimal, and fractional formats
- Host: GitHub
- URL: https://github.com/sharapov-outsource/odds-converter
- Owner: sharapov-outsource
- License: other
- Created: 2017-05-13T16:57:05.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-16T13:53:36.000Z (about 9 years ago)
- Last Synced: 2024-06-13T16:34:19.325Z (almost 2 years ago)
- Topics: conversion, formulas, odds, php, sports
- Language: PHP
- Homepage:
- Size: 3.91 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Odds Converter
======================
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](getcomposer.org). To use Composer, simply add the following to your `composer.json` file.
```json
{
"require": {
"sharapov/odds-converter": "1.01"
}
}
```
How to use it?
--------------
```php
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
```php
$converter->setOdd('275');
```
##### Get fractional
```php
print $converter->getFractional(); // 11/4
```
##### Get decimal
```php
print $converter->getDecimal(); // 3.75
```
#### Set fractional input
```php
$converter->setOdd('11/4');
```
##### Get moneyline (US)
```php
print $converter->getMoneyline(); // 275
```
##### Get decimal
```php
print $converter->getDecimal(); // 3.75
```
#### Set decimal input
```php
$converter->setOdd('3.75');
```
##### Get moneyline (US)
```php
print $converter->getMoneyline(); // 275
```
##### Get fractional
```php
print $converter->getFractional(); // 11/4
```
That's so easy