psvneo / hartmann-os-shoe-finder-sdk
This library provides an easy API to communicate with the hartmann-os-shoe-finder-api.
2.4.0
2022-02-04 22:28 UTC
Requires
- php: ^7.2
- ext-json: *
- guzzlehttp/guzzle: ^6.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpmd/phpmd: ^2.8
- phpstan/phpstan: 0.12.*
- phpunit/phpunit: ^8.5
- squizlabs/php_codesniffer: ^3.5
- symfony/var-dumper: ^5.0
README
This library provides an easy API to communicate with the hartmann-os-shoe-finder-api.
Requirements
- PHP 7.2+
- composer
- ext-json
How to install
Run composer require psvneo/hartmann-os-shoe-finder-sdk
.
How to use
Instantiate a new client
<?php
require_once '.../vendor/autoload.php';
$configuration = new \PSVneo\HartmannOsShoeFinderSdk\Configuration\ClientConfiguration(
"https://api-base-url.com",
"api-user@email.address",
"secret"
);
$client = new \PSVneo\HartmannOsShoeFinderSdk\Client($configuration);
Fetch data (QUERY)
<?php
# Fetch list of articles.
$data = $client->query()->getArticles(
1, // page
10, // record count
'DE' // Language code
);
# Fetch list of manufacturers.
$data = $client->query()->getManufacturers(
1, // page
10, // record count
'DE' // Language code
);
# Fetch medias of defined type.
$data = $client->query()->getMedias(
\PSVneo\HartmannOsShoeFinderSdk\GraphQL\Fields::MEDIA_TYPES['Logo']
);
# Run custom query against the server with variables.
$data = $client->query()->custom(
\PSVneo\HartmannOsShoeFinderSdk\Utility\StringUtility::trimGraphQLQueryString('
query Articles ($language: Language!) {
articles(language: $language) {
id
title
}
}
'),
[
"language" => 'EN'
]
);
Manipulate data (MUTATION)
Yet not implemented!