keepa / php_api
API Framework for Keepa.com
Installs: 386 484
Dependents: 0
Suggesters: 0
Security: 0
Stars: 50
Watchers: 9
Forks: 30
Open Issues: 0
Requires
- php: >=7.1
- ext-curl: *
- ext-json: *
- netresearch/jsonmapper: ^3.0
- dev-master
- 2.0.19
- 2.0.18
- 2.0.17
- 2.0.16
- 2.0.15
- 2.0.14
- 2.0.13
- 2.0.12
- 2.0.11
- 2.0.10
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.611
- 1.61
- 1.60
- 1.50
- 1.46
- 1.44
- 1.43.1
- 1.43
- 1.42
- 1.41
- 1.40.3
- 1.40.2
- 1.40.1
- 1.40
- 1.39.2
- 1.39.1
- 1.39
- 1.36.2
- 1.36.1
- 1.36
- 1.31
- 1.26.1
- 1.26
- 1.13.6
- 1.13.5
- 1.13.4
- 1.13.3
- 1.13.2
- 1.13.1
- 1.13
- 1.12.4
- 1.12.3
- 1.12.2
- 1.12.1
- 1.12
- 1.11.2
- 1.11.1
- 1.11
- 1.3.6
This package is auto-updated.
Last update: 2024-10-28 18:18:18 UTC
README
Keepa API Framework
This framework is intended for users of the Keepa API.
Requirements
All needed requirements (php version/external libraries) you find in can find in composer.json or on packagist
Features
- Parses API response to easy to use PHP objects
- Provides methods that facilitate the work with price history data
Composer
composer require keepa/php_api:*
Quick Example
Make an API request
<?php /* maybe required - depends if youre using a framework which automaticly loading this file require_once "vendor/autoload.php"; */ use Keepa\API\Request; use Keepa\API\ResponseStatus; use Keepa\helper\CSVType; use Keepa\helper\CSVTypeWrapper; use Keepa\helper\KeepaTime; use Keepa\helper\ProductAnalyzer; use Keepa\helper\ProductType; use Keepa\KeepaAPI; use Keepa\objects\AmazonLocale; $api = new KeepaAPI("YOUR_API_KEY"); $r = Request::getProductRequest(AmazonLocale::DE, 0, "2015-12-31", "2018-01-01", 0, true, ['B001G73S50']); $response = $api->sendRequestWithRetry($r); switch ($response->status) { case ResponseStatus::OK: // iterate over received product information foreach ($response->products as $product){ if ($product->productType == ProductType::STANDARD || $product->productType == ProductType::DOWNLOADABLE) { //get basic data of product and print to stdout $currentAmazonPrice = ProductAnalyzer::getLast($product->csv[CSVType::AMAZON], CSVTypeWrapper::getCSVTypeFromIndex(CSVType::AMAZON)); //check if the product is in stock -1 -> out of stock if ($currentAmazonPrice == -1) { echo sprintf("%s %s is currently not sold by Amazon (out of stock) %s",$product->asin,$product->title,PHP_EOL); } else { echo sprintf("%s %s Current Amazon Price: %s %s",$product->asin,$product->title,$currentAmazonPrice,PHP_EOL); } // get weighted mean of the last 90 days for Amazon $weightedMean90days = ProductAnalyzer::calcWeightedMean($product->csv[CSVType::AMAZON], KeepaTime::nowMinutes(),90, CSVTypeWrapper::getCSVTypeFromIndex(CSVType::AMAZON)); } else { } } break; default: print_r($response); }