brieucthomas / ergast-client
PHP client for Ergast Developer API
Installs: 831
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 2
Open Issues: 0
pkg:composer/brieucthomas/ergast-client
Requires
- php: >=7.0
- doctrine/collections: ^1.0
- guzzlehttp/guzzle: ^6.0
- jms/serializer: ^1.5
- psr/http-message: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.0
- phpunit/phpunit: ^5.0
This package is not auto-updated.
Last update: 2025-09-29 12:12:24 UTC
README
PHP client for Ergast Developer API.
Requirements
PHP needs to be a minimum version of PHP 7.
Installation
This library can be easily installed via Composer:
composer require brieucthomas/ergast-client
or just add it to your composer.json
file directly and run composer install.
Usage
use BrieucThomas\ErgastClient\ErgastClientBuilder; use BrieucThomas\ErgastClient\Request\RequestBuilder; $ergastClient = ErgastClientBuilder::createErgastClient(); $requestBuilder = new RequestBuilder(); $requestBuilder ->findCircuits() ->byId('monza') ; $response = $ergastClient->execute($requestBuilder->build()); $circuit = $response->getCircuits()->first(); echo $circuit->getId(); // "monza" echo $circuit->getName(); // "Autodromo Nazionale di Monza" echo $circuit->getUrl(); // "http://en.wikipedia.org/wiki/Autodromo_Nazionale_Monza" echo $circuit->getLocation()->getLocality(); // "Monza" echo $circuit->getLocation()->getCountry(); // "Italy" echo $circuit->getLocation()->getLatitude(); // 45.6156 echo $circuit->getLocation()->getLongitude(); // 9.28111
Limit and offset
$uriBuilder ->setFirstResult(2) ->setMaxResults(5) ;