Download the PHP package erlangb/betfair without Composer
On this page you can find all versions of the php package erlangb/betfair. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download erlangb/betfair
More information about erlangb/betfair
Files in erlangb/betfair
Package betfair
Short Description Betfair API PHP 5.4+ library
License MIT
Homepage http://www.danieledangeli.com
Informations about the package betfair
betfair-php
Protip: There was big chnages in the last days, please use the version 0.1.1 instead of dev-master for back compatibility.
Have a look on:
erlangb/betfair
page to choose a stable version to use, instead of dev-master
This PHP 5.4+ library helps you to interact with the Betfair API via PHP. Menù
- Main
Installation
This library can be found on Packagist. The recommended way to install this is through composer.
Run these commands to install composer, the library and its dependencies:
Or edit composer.json
and add:
Protip: you should browse the
erlangb/betfair
page to choose a stable version to use, instead of dev-master
And install dependencies:
Now you can add the autoloader, and you will have access to the library:
Usage
Obtain an APP_KEY
To use this library you have to obtain an APP_KEY from Betfair
Obtain a Betfair Object
- By using the factory interface
The last parameters are the options, which you can customize the Betfair object. The following options are available:
- loginEndpoint: array('loginEndpoint' => 'https://identitysso.betfair.it/api/login') to change the login endpoint
- responseAdapter: array('responseAdapter' => new ArrayAdapter()) to change the response adapter
- The available adapters are:
- ArrayAdapter
- ArrayRpcAdapter
- JsonRpcAdapter
Protip: You can also implement your own Adapter by implement the AdapterInterface and pass it as an option
Query the Betfair API with the helpers objects.
Once you got a Betfair object you can query the Betfair API.
There are several ways to do that.
The simplest one is just to use the available helpers methods. For instance, if you want to get all the events "filtered by event type ids" you can simply:
The available helpers are:
- $betfair->getBetfairEvent();
- $betfair->getBetfairEventType();
- $betfair->getBetfairCompetition();
- $betfair->getBetfairCountry();
- $betfair->getBetfairMarketBook();
- $betfair->getBetfairMarketCatalogue();
- $betfair->getBetfairMarketType();
- $betfair->getClearedOrder();
- $betfair->getCurrentOrder();
- $betfair->getVenues();
Protip: With the simple usage you can have access to the already existing helpers. Please feel free to contribute to this library by adding more helpers.
If an helper method is not present, you can simply use the object by specifying the parameters to execute a custom query:
If an object doesn't require a Betfair Market Filter, you can simply specify the Param:
Query the Betfair API without the helpers
If in any case you want to query the API without using the helpers you can just use the "api" function on the Betfair object:
It will accept a Param and a method name (listEevents, listMarketCatalogue ...)
To Obtain a Param object just use the proper factory:
if you want to add a market filter to the Param Object, just use the factory and then set it as following:
Both Param and MarketFilter object have a list of methods to set the properties in a "builder" style:
Read carefully the Betfair documentation API to use the proper properties with these objects.
How to contribute
I'm very glad to be helped to maintain and extend this library. Please feeling free to clone the repository and collaborate with me.
Reporting Issues
I would love to hear your feedback. Report issues using the Github Issue Tracker or email me at [email protected].
Todo
The library is actually "in dev" state and a lot of things to be done.
Enabling guzzle library- Implements more "Betfairs objects" to extend the API (priority on Order object)
Add more PHPspec testPHPspec test refactoringHandling login or app key errors in array and json RPC adapters (result is not set)Integration tests after the last changes- Add more betfair Account API helpers
All versions of betfair with dependencies
guzzlehttp/guzzle Version ~5.0
guzzlehttp/command Version 0.7.*
guzzlehttp/guzzle-services Version 0.5.*