github-bishwajeet/ls-retail-guzzle
最新稳定版本:v2.3.4
Composer 安装命令:
composer require github-bishwajeet/ls-retail-guzzle
包简介
A Guzzle HTTP Client extension for Lightspeed Retail.
README 文档
README
The class is an extension of the Guzzle 6 PHP HTTP Client for use with the Lightspeed Retail API.
It works the same way as the standard Guzzle Client, but takes care of refreshing access tokens and rate limiting.
This package was created for demonstration purposes and comes with no waranty.
Installation
Use this commmand to install with Composer:
$ composer require github-bishwajeet/ls-retail-guzzle
Alternatively, you can add these lines to your composer.json file:
"require": { "github-bishwajeet/ls-retail-guzzle": "2.*" }
Usage Example
<?php require 'vendor/autoload.php'; use LightspeedHQ\Retail\RetailClient; // Replace these with your own values for testing. // API tokens and client credentials should not be stored in your code! $account_id = XXXXX; $refresh_token = '****'; $client_id = '****'; $client_secret = '****'; $client = new RetailClient($account_id, $refresh_token, $client_id, $client_secret); // GET request with some URL paramters. We'll get the first ItemShop // from this item and dump it. $query = [ 'load_relations' => '["ItemShops"]', 'description' => '~,%test%', 'limit' => 1 ]; $response = $client->get('Item', ['query' => $query]); $items = json_decode($response->getBody(), true)['Item']; echo '<h3>GET Test</h3>'; echo '<pre>'; var_dump($items['ItemShops']['ItemShop'][0]) echo '</pre>' // POST request to create an Item $payload = [ 'description' => 'Rest Test', 'Prices' => [ 'ItemPrice' => [ 'amount' => 100, 'useType' => 'Default' ] ] ]; $response = $client->post('Item', ['json' => $payload]); echo '<h3>POST Test</h3>'; echo '<pre>'; var_dump(json_decode($response->getBody(), true)); echo '</pre>';
统计信息
- 总下载量: 56
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-03