flostone/amazon

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (1.1.0) of this package.

Amazon API Package

1.1.0 2017-10-27 12:54 UTC

This package is not auto-updated.

Last update: 2020-04-12 16:25:03 UTC


README

#Amazon Api Helper

Installation

Add this package to your composer.json or execute
composer require flostone/amazon
Include the Amazon Class using
use FloStone\Amazon\Amazon;
and
use FloStone\Amazon\AmazonCountry;
for the available countries. ##Usage ###Amazon Credentials All you need is an Amazon Access Key (public and secret) and an Associate Tag.
You can get your Access Key here
For the Associate Tag you must create an Associate Account here

###Using the Code Create a new Amazon instance using
$amazon = new Amazon($accesskey, $associatetag, $secretkey, $locale);
The locale can be any of the supported Amazon Locales.
You can use strings or the pre-defined constants found in AmazonCountry.php.
Constants:
AmazonCountry::US // USA
AmazonCountry::DE // Germany
AmazonCountry::FR // France
AmazonCountry::UK // United Kingdom
AmazonCountry::IT // Italy
AmazonCountry::ES // Spain
AmazonCountry::BR // Brasil
AmazonCountry::CA // Canada
AmazonCountry::CN // China
AmazonCountry::IN // India
AmazonCountry::JP // Japan
AmazonCountry::MX // Mexico
After initializing the Instance, you can now add Parameters using the "param" function:
$amazon->param('Operation', 'ItemSearch');
These parameters will be in the request url.
After adding all your parameters, simply use the "request" function to send the request:
$response = $amazon->request()
By default the response will be a Page of the Amazon API parsed through the SimpleXMLElement class.
However, if you wish to get all Pages in a returned collection, simply add
$amazon->allPages = true
to the instance and it will return a collection of 10 Pages.