I will guide you to do this in a simple and more Laravel
Way.
so you can create a folder libraries
under app
directory
and place your amazon api files in the libraries
folder.
Now in your composer.json
add "app/your_amozon_api_library_folder_name"
in classmap , something like
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/your_amozon_api_library_folder_name",
Now dump your autoload using composer dump-autoload or php composer.phar dump-autoload
Now you amozon api's are loaded for global use.
Suppose you have a HomeController with search method, now put you api codes in search method,
public function search(){
if(isset($_GET['booksearch'])) {
/* Example usage of the Amazon Product Advertising API */
//include("amazon_api_class.php"); no need to include
$obj = new AmazonProductAPI();
$result ='' ;
try
{
$result = $obj->searchProducts($_GET['booksearch'],
AmazonProductAPI::DVD,
"TITLE");
}
catch(Exception $e)
{
echo $e->getMessage();
}
//print_r($result->Items);
return View::make('your view name')->with('items',$result->Items);
}
}