PHPackages                             sethsharp/odds-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. sethsharp/odds-api

ActiveLibrary[API Development](/categories/api)

sethsharp/odds-api
==================

This is a convenient composer wrapper for the odds-api.

v1.3.0(11mo ago)13.1k↓50%MITPHPPHP ^8.2 | ^8.3 | ^8.4CI passing

Since Jul 13Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/SethSharp/odds-api)[ Packagist](https://packagist.org/packages/sethsharp/odds-api)[ Docs](https://github.com/SethSharp/odds-api)[ RSS](/packages/sethsharp-odds-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (17)Used By (0)

Odds API Wrapper
================

[](#odds-api-wrapper)

[![Tests](https://github.com/SethSharp/odds-api/actions/workflows/testing.yml/badge.svg)](https://github.com/SethSharp/odds-api/actions/workflows/testing.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/7018e609d8801957c33f702417560d1e9e244080a42d9020a0b34bbccbc1b587/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7365746873686172702f6f6464732d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sethsharp/odds-api)[![Total Downloads](https://camo.githubusercontent.com/01d55a6cae8375fde3102abd4225718154595da149222d03e20f2745e1af60b5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7365746873686172702f6f6464732d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sethsharp/odds-api)

A convenient API wrapper for the Odds API, designed for Composer environments such as Laravel.

About "The Odds API"
--------------------

[](#about-the-odds-api)

[The Odds API](https://the-odds-api.com/) is a simple and very well-documented API, allowing for fast, low-cost integration. It covers over 70 sports and over 40 bookmakers - with a continuing expanding offering. The Odds API is an Australian company based in Melbourne since 2017.

Why a Wrapper?
--------------

[](#why-a-wrapper)

A wrapper simplifies the usage and implementation of powerful APIs like "The Odds API". It abstracts the complexities of direct API interactions, providing a more user-friendly interface for us developers.

Contribution Guide
==================

[](#contribution-guide)

This is an open-source project, so contributions are welcome! Whether you want to add new features, fix bugs, or improve documentation, your help is appreciated. Submit your PR for review and I will review them as soon as possible.

Steps for Installation
======================

[](#steps-for-installation)

### Composer

[](#composer)

```
composer require sethsharp/odds-api
```

### Publish Config file

[](#publish-config-file)

This file contains some essential information the Client requires to make successful requests

```
php artisan vendor:publish --tag="odds-api-config"
```

### Example Usages

[](#example-usages)

You can simply create a new Client, passing in your api key and that's it!

```
$client = new OddsClient(config('odds-api.api_key'));

$response = $client->setRegion('au')
    ->dateFormat('iso')
    ->getOddsForSport(SportsEnum::RUGBYLEAGUE_NRL);

return $response->json();
```

This package is set up in a way that all the params you need can be built using chainable function helpers, as they all return `$this`. Once you call one of the API endpoints which return a response, you can no longer call these function helpers.

**Another way to define your Client Class**

You can bind your Client class at runtime in the AppServiceProvider. Allowing you to simply define the Client on the container (via the constructor of a class in Laravel), without having to constantly pass the api credentials.

```
$this->app->bind(OddsClient::class, function () {
    return new OddsClient(config('odds-api.api_key'));
});
```

then your class may look like

```
use HandlesOddsResponse;

public function __invoke(OddsClient $client): Response
{
    $response = $client->setRegion('us')
        ->getOddsForSport(SportsEnum::RUGBYLEAGUE_NRL);

    return $this->extractJsonFromResponse($response);
}
```

**Additional:**When constructing the Client, it will have some default parameters

```
$this->params = [
    'api_key' => $this->apiKey,
    'regions' => config('odds-api.default_region'),
    'oddsFormat' => config('odds-api.default_odds_format')
];
```

This avoids having to define these on each request, but they can be overwritten with their corresponding class functions ie; `setRegions('au')`

To help manage your quota, there are helpers that you can call to return the number of requests used and remaining. Checkout the `UseHandleHeaders` trait, which can be called on any `OddsClient` instant.

Also, if this API ever becomes outdated for a small period of time and you need to add new parameters, you can utilise the `addParams()` function, which accepts an array.

Credits
-------

[](#credits)

- [Seth Sharp](https://github.com/SethSharp)
- [All Contributors](https://github.com/SethSharp/odds-api/graphs/contributors)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance51

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Recently: every ~76 days

Total

16

Last Release

348d ago

PHP version history (2 changes)v1.0.0-alpha.1PHP ^8.2

v1.2.0PHP ^8.2 | ^8.3 | ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc8ebc5236b1f9c1c783963791cec4fbfeff6a34f9853104724dae03ad9b5238?d=identicon)[SethSharp](/maintainers/SethSharp)

---

Top Contributors

[![SethSharp](https://avatars.githubusercontent.com/u/58869086?v=4)](https://github.com/SethSharp "SethSharp (60 commits)")

---

Tags

apicomposer-packageodds-apiopen-sourcewrapper

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/sethsharp-odds-api/health.svg)

```
[![Health](https://phpackages.com/badges/sethsharp-odds-api/health.svg)](https://phpackages.com/packages/sethsharp-odds-api)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[ashallendesign/laravel-exchange-rates

A wrapper package for interacting with the exchangeratesapi.io API.

485677.8k](/packages/ashallendesign-laravel-exchange-rates)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1221.1k](/packages/codebar-ag-laravel-docuware)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
