lucasaba / soccersapi
PHP Client for rapidapi.com
v0.1.3
2021-09-23 17:29 UTC
Requires
- jms/serializer: ^3.14
- symfony/console: ^5.3
- symfony/http-client: ^5.3
Requires (Dev)
- phpunit/phpunit: ^9.5
- vimeo/psalm: ^4.10
README
RapidAPI - PHP Soccer client
RapidAPI offers different kind of api information.
This library is a PHP client for (some) of the Soccer API v3.
Installation
...package to be published
Usage
In order to use this library you need to create a Client
The client needs a HttpClientInterface, a serializer and the API Token:
$serializer = SerializerBuilder::create()->build(); $client = new Client(HttpClient::create(), $serializer, 'this-is-a-secret-token');
Then, you need to feed the client with a request. Request are in the src/Request
folder.
Each request ha different kind of parameters. You can use autocomplete to have a suggestion of them.
E.g.
$request = new LeaguesRequest(); $request->withCountry('Italy') ->withSeason(2021) ->withType(League::LEAGUE_TYPE_CUP); $response = $client->get($request, LeaguesResponse::class, true);
The second argument of the client get
method is the expected response type.
It is used by the serializer to correctly deserialize the object.