ilazaridis / skroutz
此包已被弃用且不再维护。未建议替代包。
skroutz.gr API 的 PHP7 库
1.0.0
2017-02-05 02:20 UTC
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: 5.5.*
This package is not auto-updated.
Last update: 2022-11-12 17:01:48 UTC
README
skroutz API 的 PHP7 客户端
安装
composer require ilazaridis/skroutz
使用示例
一旦你有了 Identifier
和 Secret
,你就可以生成访问令牌
<?php require_once 'vendor/autoload.php'; use ilazaridis\skroutz\Client as Client; $client = new Client('identifier', 'secret');
并使用它
print_r($client->category('40')->fetch()); // get category with id=40
fetch(bool $decode = true, string $apiVersion = '3.1')
默认使用最新版本的 API 返回关联数组。如果你想更改这些值,可以传递布尔值和字符串。
- 列出某个类别的子类别
$client->category('40')->children()->fetch()
- 检索单个商店位置
$client->shop('452')->location('2500')->fetch()
- 按名称检索制造商的类别
$client->category('25')->manufacturers()->params(['order_by' => 'name', 'order_dir' => 'asc'])->fetch()
查询字符串通过 params() 方法作为关联数组传递。如果有多个相同参数的值(即 filter_ids[]
),我们将它们作为逗号分隔的值传递
- 使用多个过滤器 ID 过滤特定类别的 SKU
$client->category('40')->skus()->params(['filter_ids[]' => '355559,6282'])->fetch()
注意
由于访问限制,一些 API 方法尚未实现。目前,获取的权限级别是 public
,并且实现了该级别上的所有内容。