A client for Sylius APIs
$ composer require friendsofapi/sylius-api-client
$apiClient = SyliusClient::create($endpoint, $clientId, $clientSecret); $accessToken = $apiClient->createNewAccessToken($username, $password); $apiClient->authenticate($accessToken); $allProducts = $apiClient->product()->getAll()
APIs are usually split into categories, called Resources.
In your implementation you should also reflect these categories, for example by having their own classes in
Let's take a look at
Api/Stats in our case. The response of any call should be an object in
The end user chooses which hydrator to use. The default one should return domain objects.
The request builder creates a PSR-7 request with a multipart stream when necessary
If the API does not require multipart streams you should remove the
and replace it with a
The MIT License (MIT). Please see License File for more information.