Download the PHP package gryfoss/odds without Composer
On this page you can find all versions of the php package gryfoss/odds. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Vendor gryfoss
Package odds
Short Description PHP package for dealing with different formats of betting odds: decimal (European), fractional (British), and moneyline (American)
License MIT
Package odds
Short Description PHP package for dealing with different formats of betting odds: decimal (European), fractional (British), and moneyline (American)
License MIT
Please rate this library. Is it a good library?
Informations about the package odds
Odds Formatter
PHP package for dealing with different formats of betting odds: decimal (European), fractional (British), and moneyline (American).
🚀 New Architecture (v2.0)
This library has been completely redesigned with:
- Immutable
Oddsclass containing all formats and probability (not meant for direct instantiation - useOddsFactory) OddsFactorywith dependency injection for conversion strategies- String-based decimals for precision and security (no more float issues!)
- bcmath calculations for exact mathematical operations
- Extensible odds ladder system via interfaces
- Fixed precision integer support for performance-critical applications
Features
- ✅ Precision: String-based decimals with bcmath calculations
- ✅ Immutable design: Thread-safe odds objects
- ✅ All-in-one: Single object contains decimal, fractional, moneyline, and probability
- ✅ Dependency injection: Configurable conversion strategies
- ✅ Extensible: Custom odds ladder implementations
- ✅ Comprehensive: Full test coverage
Requirements
- PHP 8.4+ (required for bcmath precision functions)
- bcmath extension (standard in most installations)
- Composer
Installation
Quick Start
Usage Examples
Basic Conversions
With Odds Ladder
Custom Odds Ladder
Working with Fixed Precision Integers
For performance-critical applications, you can work directly with fixed precision integers (decimal * 100):
Migration from old odds-formatter.
See STRING_DECIMAL_GUIDE.md for detailed migration instructions.
Key Changes:
- Use
OddsFactoryinstead of individual odd classes - Pass decimals as strings:
'2.50'instead of2.50 - All return values are strings for precision (except
getProbability()which returns integer) - Single
Oddsobject contains all formats Oddsclass is immutable and should not be instantiated directly
Documentation
- String Decimal Guide - Precision and migration
- NEW_API.md - Complete API documentation
License
This is an open-sourced software licensed under the MIT license.
All versions of odds with dependencies
PHP Build Version
Package Version
The package gryfoss/odds contains the following files
Loading the files please wait ...