alexsabdev / odds
PHP package for dealing with different formats of betting odds: decimal (European), fractional (British), and moneyline (American)
Installs: 5 520
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 0
Forks: 3
Open Issues: 1
Requires
- php: ^7.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.11
- phpunit/phpunit: ^7.1
This package is not auto-updated.
Last update: 2025-09-14 10:09:14 UTC
README
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.