psvneo / hartmann-os-shoe-finder-sdk
这个库提供了一个简单的API,用于与 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
这个库提供了一个简单的API,用于与 hartmann-os-shoe-finder-api 通信。
要求
- PHP 7.2+
- composer
- ext-json
如何安装
运行 composer require psvneo/hartmann-os-shoe-finder-sdk
。
如何使用
实例化一个新的客户端
<?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);
获取数据(查询)
<?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'
]
);
操作数据(变更)
尚未实现!