theshopdev / api-client
theshop API客户端,用于Laravel。
1.0.4
2023-11-14 14:43 UTC
Requires
- php: ^8.1
- ext-json: *
- guzzlehttp/guzzle: ^7.0
- laravel/framework: ^8.0 || ^9.0 || ^10.0
This package is auto-updated.
Last update: 2024-09-05 10:38:52 UTC
README
composer require theshopdev/api-client
- 将
\Theshop\ApiClient\ApiClientServiceProvider::class
添加到config/app.php
的提供者中。 - 填写.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 ) ]);