mikemiles86/bazaarvoice-request
最新稳定版本:1.0.4
Composer 安装命令:
composer require mikemiles86/bazaarvoice-request
包简介
PHP library for making requests to Bazaarvoice API.
关键字:
README 文档
README
PHP library for making requests to Bazaarvoice APIs
Bazaarvoice Request Library
PHP library for making requests to Bazaarvoice APIs and handling responses.
Install
Via Composer
$ composer require mikemiles86/bazaarvoice-request
Usage
Creating a Request
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);
Making a request
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $reviews = $bazaarvoice_request->apiRequest('data/reviews');
Making a staging request
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $reviews = $bazaarvoice_request->useStage()->apiRequest('data/reviews');
Making a request with additional configurations
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $configuration = [ 'method' => 'POST', 'options' => [ 'headers' => [ 'X-Forwarded-For' => '127.0.0.1', ], ], ]; $reviews = $bazaarvoice_request->apiRequest('data/reviews', $configuration);
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $configuration = [ 'arguments' => [ 'ProductId' => 'my_product_123', ], ]; $product_reviews = $bazaarvoice_request->->apiRequest('data/reviews', $configuration);
Get values from a response
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $response = $bazaarvoice_request->useStage()->apiRequest('data/reviews'); $reviews = $response->getResponse('Results');
Get errors from a response
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $response = $bazaarvoice_request->useStage()->apiRequest('data/reviews'); if ($response->getStatusCode() != '200' || $response->hasErrors()) { $errors = $response->getErrors(); }
Testing
$ composer test
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 60.35k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-05-17