PHPackages                             dcro/simple-betfair-php-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. dcro/simple-betfair-php-api

ActiveLibrary[API Development](/categories/api)

dcro/simple-betfair-php-api
===========================

A simple PHP implementation for Betfair's API (API-NG)

91804PHP

Since Sep 17Pushed 11y ago2 watchersCompare

[ Source](https://github.com/dcro/simple-betfair-php-api)[ Packagist](https://packagist.org/packages/dcro/simple-betfair-php-api)[ RSS](/packages/dcro-simple-betfair-php-api/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Simple Betfair PHP API
======================

[](#simple-betfair-php-api)

This is a simple PHP implementation for [Betfair's API (API-NG)](https://api.developer.betfair.com/services/webapps/docs/display/1smk3cen4v3lu3yomq5qye0ni/API-NG+Overview). It handles both authentication against the SSO endpoint &amp; requests against the JSON-RPC endpoint.

Installation
------------

[](#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.

```
{
    "require": {
        "dcro/simple-betfair-php-api": "dev-master"
    }
}
```

How to use it?
--------------

[](#how-to-use-it)

To initialize the API, you'll need to pass an array with your application key (`appKey`), `username`, `password` and certificate file (`cert`). Check out the Betfair API documentation for details on how to get these.

```
// Set the API configuration
$configuration = array(
    'appKey'   => '',
    'username' => '',
    'password' => '',
    'cert'     => '/path/to/your/certificate.pem',
)

$api = new Betfair\SimpleAPI($configuration);
```

To make a request against the API endpoint, call the `request()` method like this:

```
try {
    // List event types
    $response = $api->request('listEventTypes', '{"filter":{}}');

} catch (Exception $ex) {
    // handle the exception
}
```

A more complex request example, to get the market catalogue for a specific event type (``) from Great Britain and for the `WIN` market.

```
try {
    // Define the parameters
    $params = '{
                   "filter" : {
                       "eventTypeIds" : [""],
                       "marketCountries" : ["GB"],
                       "marketTypeCodes" : ["WIN"],
                       "marketStartTime" : {"from":"' . date('c') . '"}
                   },
                   "sort" : "FIRST_TO_START",
                   "maxResults" : "1000",
                   "marketProjection" : ["EVENT","MARKET_START_TIME","RUNNER_DESCRIPTION","MARKET_DESCRIPTION"]
              }';

    // Get the market catalogue
    $response = $api->request('listMarketCatalogue', $params);

} catch (Exception $ex) {
    // handle the exception
}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c2836263553eacf59ffb398fc13e0a0862d0a4cff602df54d041ce2442fef31?d=identicon)[dcro](/maintainers/dcro)

---

Top Contributors

[![dcro](https://avatars.githubusercontent.com/u/1079773?v=4)](https://github.com/dcro "dcro (13 commits)")

### Embed Badge

![Health badge](/badges/dcro-simple-betfair-php-api/health.svg)

```
[![Health](https://phpackages.com/badges/dcro-simple-betfair-php-api/health.svg)](https://phpackages.com/packages/dcro-simple-betfair-php-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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