orzcc / laravel-amazon-product-api
Laravel亚马逊产品广告API
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-09-21 07:24:26 UTC
README
更新时间
从kawax/laravel-amazon-product-api分叉
活跃支持结束(2020/06)
我的API账号已被封禁,因此我的活跃支持已经结束。但是,接受PR。
要求
- PHP >= 7.3
- Laravel >= 6.0
版本控制
- 基本:semver
- 删除旧PHP或Laravel版本:
+0.1
。composer应该能很好地处理。 - 仅支持最新主要版本(
master
分支),但你也可以向旧分支提交PR。
安装
Composer
composer require orzcc/laravel-amazon-product-api
发布配置(可选)
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
国家列表
https://webservices.amazon.com/paapi5/documentation/common-request-parameters.html
注意
用法
<?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()
不包含详细信息。
$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?
你可能需要尝试-catch或Laravel的rescue()
辅助函数。
try { $response = AmazonProduct::browse('1'); } catch(ApiException $e) { } $response = rescue(function () use ($browse_id) { return AmazonProduct::browse($browse_id); }, []);
许可证
MIT
版权所有kawax