orzcc / laravel-amazon-product-api
Amazon Product Advertising API for Laravel
4.7
2023-06-21 04:43 UTC
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^7.5
- illuminate/support: ^6|^7|^8|^9|^10
Requires (Dev)
- orchestra/testbench: ^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0
- dev-master
- 4.7
- 4.6
- 4.5.13
- 4.5.12
- 4.5.11
- 4.5.10
- 4.5.9
- 4.5.8
- 4.5.7
- 4.5.6
- 4.5.5
- 4.5.4
- 4.5.3
- 4.5.2
- 4.5.1
- 4.5.0
- 4.4.0
- 4.3.0
- 4.2.1
- 4.2.0
- 4.1.1
- 4.1.0
- 4.0.9
- 4.0.8
- 4.0.7
- 4.0.6
- 4.0.5
- 4.0.4
- 4.0.3
- 4.0.2
- 4.0.1
- 4.0.0
- 3.0.0
- 2.0.x-dev
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.1.0
- 1.0.x-dev
- 1.0.1
- 1.0.0
- 0.4.0
- 0.3.0
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.0
- dev-paapi5
This package is auto-updated.
Last update: 2024-10-21 07:30:21 UTC
README
Updated
forked from kawax/laravel-amazon-product-api
End of active support (2020/06)
My API account has been banned, so my active support is over. However, PR is accepted.
Requirements
- PHP >= 7.3
- Laravel >= 6.0
Versioning
- Basic : semver
- Drop old PHP or Laravel version :
+0.1
. composer should handle it well. - Support only latest major version (
master
branch), but you can PR to old branches.
Installation
Composer
composer require orzcc/laravel-amazon-product-api
Publishing config (Optional)
php artisan vendor:publish --tag=amazon-product-config
.env
AMAZON_API_KEY= AMAZON_API_SECRET_KEY= AMAZON_ASSOCIATE_TAG= AMAZON_HOST=webservices.amazon.com AMAZON_REGION=us-east-1
Country lists
https://webservices.amazon.com/paapi5/documentation/common-request-parameters.html
Note
Usage
<?php use Orzcc\Amazon\ProductAdvertising\Facades\AmazonProduct; # string $category, string $keyword = null, int $page = 1 $response = AmazonProduct::search('All', 'amazon' , 1); dd($response); # returns normal array # string $browse Browse node $response = AmazonProduct::browse('1'); # string $asin ASIN $response = AmazonProduct::item('ASIN1'); # array $asin ASIN $response = AmazonProduct::items(['ASIN1', 'ASIN2']); # setIdType: support only item() and items() $response = AmazonProduct::setIdType('EAN')->item('EAN'); # reset to ASIN AmazonProduct::setIdType('ASIN'); # PA-APIv5 not support EAN?
browse()
is not contains detail data.
$response = AmazonProduct::browse('1'); $nodes = data_get($response, 'BrowseNodesResult'); $items = data_get($nodes, 'BrowseNodes.TopSellers.TopSeller'); $asins = data_get($items, '*.ASIN'); $results = AmazonProduct::items($asins); # PA-APIv5 not support TopSeller?
Probably, you need try-catch or Laravel's rescue()
helper.
try { $response = AmazonProduct::browse('1'); } catch(ApiException $e) { } $response = rescue(function () use ($browse_id) { return AmazonProduct::browse($browse_id); }, []);
LICENSE
MIT
Copyright kawax