atapatel/sylius-api-client

A client for Sylius APIs

Installs: 722

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 8

pkg:composer/atapatel/sylius-api-client

0.2.6 2020-05-25 08:53 UTC

This package is not auto-updated.

Last update: 2025-10-08 21:52:05 UTC


README

Latest Version Build Status Code Coverage Quality Score Total Downloads

Install

Via Composer

$ composer require friendsofapi/sylius-api-client

Usage

$apiClient = SyliusClient::create($endpoint, $clientId, $clientSecret);
$accessToken = $apiClient->createNewAccessToken($username, $password);
$apiClient->authenticate($accessToken);
$allProducts = $apiClient->product()->getAll()

Develop

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 Api/. Let's take a look at Api/Stats in our case. The response of any call should be an object in Model/Stats/X, like Model/Stats/Total.

Hydrator

The end user chooses which hydrator to use. The default one should return domain objects.

Request builder

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 RequestBuilder and replace it with a RequestFactory.

License

The MIT License (MIT). Please see License File for more information.