Skip to content

theRealPengBang/simpleapa

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleAPA

A simple wrapper for https://github.com/Exeu/apai-io Amazon Product Advertising API.

Installation

Add to composer.json:

{
    "require": {
        "rootman/simpleapa": "~1.0"
    }
}

Fire up composer:

$ composer install

Laravel specific

Register the Serviceprovider.

Publish the config:

$ php artisan vendor:publish

Fill the config.

Usage

Framework agnostic

use ApaiIO\ApaiIO;
use ApaiIO\Configuration\GenericConfiguration;

$conf = new GenericConfiguration();
$conf
    ->setCountry('de')
    ->setAccessKey('AMAZON ACCESS KEY')
    ->setSecretKey('AMAZON SECRET KEY')
    ->setAssociateTag('AMAZON ASSOCIATE TAG')
    ->setRequest('\ApaiIO\Request\Soap\Request')
    ->setResponseTransformer('\ApaiIO\ResponseTransformer\ObjectToArray');

$apa = SimpleAPA(new ApaiIO($conf));

$apa->bestPrice('B004BM3M6W');

Laravel

$apa = App::make('SimpleAPA'); // don't actually use it like that, better inject it

$apa->bestPrice('B004BM3M6W');

Cached example

$apa = App::make('SimpleAPA');

return Cache::remember('asin_B000OG4YNE', 60*24, function() use ($apa) {
    return $apa->bestPrice('B000OG4YNE');
});

About

Simple access to Amazon Product Advertising API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%