PHP code example of revolution / laravel-amazon-product-api
1. Go to this page and download the library: Download revolution/laravel-amazon-product-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
revolution / laravel-amazon-product-api example snippets
use Revolution\Amazon\ProductAdvertising\Facades\AmazonProduct;
# string $category, string $keyword = null, int $page = 1
$response = AmazonProduct::search(category: 'All', keyword: 'amazon' , page: 1);
dd($response);
# returns normal array
# string $browse Browse node
$response = AmazonProduct::browse(node: '1');
# string $asin ASIN
$response = AmazonProduct::item(asin: 'ASIN1');
# array $asin ASIN
$response = AmazonProduct::items(asin: ['ASIN1', 'ASIN2']);
# setIdType: support only item() and items()
$response = AmazonProduct::setIdType(idType: 'EAN')->item(asin: 'EAN');
# reset to ASIN
AmazonProduct::setIdType(idType: 'ASIN');
# PA-APIv5 not support EAN?
use Revolution\Amazon\ProductAdvertising\Facades\AmazonProduct;
$response = AmazonProduct::browse(node: '1');
$nodes = data_get($response, 'BrowseNodesResult');
$items = data_get($nodes, 'BrowseNodes.TopSellers.TopSeller');
$asins = data_get($items, '*.ASIN');
$results = AmazonProduct::items(asin: $asins);
# PA-APIv5 not support TopSeller?