The way you can use any layer of these contracts is standardized by the
The main class for each layer must implement the following interface.
This contract is the entry point for all implementations. Take a look at the following example.
$client = new MyClient();
$response = $client->call('GET', 'https://api.ratesapi.io/api/2020-07-24/?base=USD');
We've created an instance of
MyClient and have executed the
call method of the interface
You can do any request with a class that implements this contract.
When you perform a request, a class that implements the
HttpClientRequest prepares all data to the client adapter to make the request.
In the same way, when you get a response, you'll get an instance of a class that implements the
However, you don't have to create a
HttpClientRequest to perform a request. It should be as simple as passing
uri to the
or use prepared requests to build a more complex request.