theshopdev/api-client

theshop API客户端,用于Laravel。

1.0.4 2023-11-14 14:43 UTC

This package is auto-updated.

Last update: 2024-09-05 10:38:52 UTC


README

  1. composer require theshopdev/api-client
  2. \Theshop\ApiClient\ApiClientServiceProvider::class添加到config/app.php的提供者中。
  3. 填写.env文件中的值
THESHOP_API_KEY=
THESHOP_API_ENDPOINT=
THESHOP_CATALOG=

使用方法

单个请求的使用

$data = $this->getConnector()->send(new ProductListRequest(
    limit: 8,
    offset: 0
))->data;

多个异步请求的使用

$data = $this->getConnector()->sendMultiple([
    'pages' => new ProductListRequest(
        limit: 8,
        offset: 0
    ),
    'categories' => new ProductListRequest(
        limit: 8,
        offset: 0
    )
]);