2017 © Pedro Peláez
 

library simple-betfair-api-php

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

image

doug-thwaites/simple-betfair-api-php

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

  • Thursday, November 17, 2016
  • by DougThwaites
  • Repository
  • 1 Watchers
  • 0 Stars
  • 57 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

Thanks go to the original developer "dcro/simple-betfair-php-api"

All I have done is add an optional endpoint type the the configuration to set either 'betting' or 'accounts'., (*1)

Simple Betfair PHP API

This is a simple PHP implementation for Betfair's API (API-NG). It handles both authentication against the SSO endpoint & requests against the JSON-RPC endpoint., (*2)

Installation

You can either get the files from GIT or you can install the library via Composer. To use Composer, simply add the following to your composer.json file., (*3)

{
    "require": {
        "doug-thwaites/betfair-esa-client": "^1.0"
    }
}

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., (*4)

// Set the API configuration
$configuration = array(
    'appKey'   => '<betfair-application-key>',
    'username' => '<betfair-api-username>',
    'password' => '<betfair-api-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:, (*5)

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 (<your-event-type-id>) from Great Britain and for the WIN market., (*6)

try {
    // Define the parameters
    $params = '{
                   "filter" : {
                       "eventTypeIds" : ["<your-event-type-id>"],
                       "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
}

The Versions

17/11 2016

dev-master

9999999-dev

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

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.0

 

by Dan Cotora

api json-rpc betfair api-ng

17/11 2016

1.0.8

1.0.8.0

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

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.0

 

by Dan Cotora

api json-rpc betfair api-ng

01/10 2016

1.0.6

1.0.6.0

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

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.0

 

by Dan Cotora

api json-rpc betfair api-ng

01/10 2016

1.0.7

1.0.7.0

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

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.0

 

by Dan Cotora

api json-rpc betfair api-ng

21/09 2016

1.0.4

1.0.4.0

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

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.0

 

by Dan Cotora

api json-rpc betfair api-ng

21/09 2016

1.0.5

1.0.5.0

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

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.0

 

by Dan Cotora

api json-rpc betfair api-ng

21/09 2016

1.0.2

1.0.2.0

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

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.0

 

by Dan Cotora

api json-rpc betfair api-ng

21/09 2016

1.0.3

1.0.3.0

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

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.0

 

by Dan Cotora

api json-rpc betfair api-ng

21/09 2016

1.0.1

1.0.1.0

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

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.0

 

by Dan Cotora

api json-rpc betfair api-ng

21/09 2016

1.0.0

1.0.0.0

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

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.0

 

by Dan Cotora

api json-rpc betfair api-ng