With Laravel, search and lookup Amazon products easily.

Overview

Amazon ECS (E-Commerce Services) Package for Laravel

If you need the ability to search Amazon's catalog of products or lookup an individual item with Laravel, then this may be the package for you.

Please note, you'll need to ensure you have an associate tag before using this package.

Installation

composer require dawson/amazon-ecs

After you have successfully installed, add the follow Service Provider to your config/app.php.

Dawson\AmazonECS\AmazonECSServiceProvider::class,

And the following facade, also in config/app.php.

'Amazon' => Dawson\AmazonECS\AmazonECSFacade::class

Now we'll go ahead and publish the amazon.php configuration file.

php artisan vendor:publish --provider="Dawson\AmazonECS\AmazonECSServiceProvider"

Open up the amazon.php configuration file and enter your credentials or leverage the use of environment variables which're used by default.

When it comes to choosing a locale, you have a choice of the following:

Locale Country
co.uk United Kingdom
com United States
ca Canada
com.br Brazil
de Germany
es Spain
fr France
in India
co.jp Japan
com.mx Mexico

You should now be correctly configured!

Usage

Currently, there are two methods available which are search and lookup.

Search

$results = Amazon::search('Home Alone')->json();

It's that simple!

Please note, this currently searches the entire Amazon catalog. I plan on adding the ability to search within a given category soon so keep an eye out for that.

Lookup

You can also lookup any given item, assuming it's availble on your configure locale and is a valid ASIN, of which is possible by doing the following:

$product = Amazon::lookup('B004VLKY8M')->json();

This will simply return the product, it's attributes and item links.

Responses

Currently, there are two available response methods. The default xml method, or my preferred - json.

The following returns an XML string.

$xml = Amazon::search('Call of Duty')->xml();

And as you can probably assume, the following returns a JSON string.

$json = Amazon::search('Halo')->json();

Questions & Issues

Should you have any questions or come across a problem, please feel free to submit an issue.

License

This package is open-sourced software licensed under the MIT license.


Planned

  • Finish Documentation
  • Locales
  • Better Exception Handling
  • Cart abilities, such as modifying, adding, clearing etc.
  • XML to JSON (the ECS API returns an XML response, I myself would like to have the ability to convert this to JSON - but optional)
Comments
  • Call to undefined method GuzzleHttp\Psr7\Response::json()

    Call to undefined method GuzzleHttp\Psr7\Response::json()

    Hi I have this error after setting up the package:

    Call to undefined method GuzzleHttp\Psr7\Response::json()

    and that's my code in the controller which I called it directly from the home controller just for testing.

    public function index()
        {
            $results = \Amazon::search('Home Alone')->json();
    

    Thanks in advance, And thank you for the hard work and the time you given to this great project. Thanks

    Hint: I'm using it on Laravel 5.3

    opened by Xoshbin 8
  • Not receiving any items

    Not receiving any items

    Hi there,

    I included the package for my laravel app. ItemLookup is working and I receive the correct output. For the ItemSearch operation I do not receive any items, so my response looks like this:

    bildschirmfoto 2017-09-07 um 10 38 42

    The request seems to be valid. AWS keys are correct as well since otherwise the ItemLookup would not work. I tried with several keywords where amazon definitely has products. I deleted my vendor folder and run composer install.

    I appreciate any kind of help or ideas what the problem might be!

    Cheers, Sebastian

    opened by sebastian-walter 7
  • composer require dawson/amazon-ecs on Laravel 5.6 - Your requirements could not be resolved to an installable set of packages.

    composer require dawson/amazon-ecs on Laravel 5.6 - Your requirements could not be resolved to an installable set of packages.

    Hello thank you for this package - i'm trying to install on a new Laravel 5.6 project and receiving the following error message:

    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - Installation request for symfony/http-foundation (locked at v4.0.6) -> satisfiable by symfony/http-foundation[v4.0.6].
        - dawson/amazon-ecs 2.0.1 requires symfony/psr-http-message-bridge 0.2 -> satisfiable by symfony/psr-http-message-bridge[v0.2].
        - dawson/amazon-ecs v2.0.0 requires symfony/psr-http-message-bridge 0.2 -> satisfiable by symfony/psr-http-message-bridge[v0.2].
        - Conclusion: don't install symfony/psr-http-message-bridge v0.2
        - Installation request for dawson/amazon-ecs ^2.0 -> satisfiable by dawson/amazon-ecs[2.0.1, v2.0.0].
    
    
    Installation failed, reverting ./composer.json to its original content.
    
    opened by fri3ndly 5
  • Caompatibility with Laravel 5.4

    Caompatibility with Laravel 5.4

    Dear Joe, It looks like the package is not compatible with Laravel 5.4 is there anyway to fix this issue?

    Problem 1                                                                                                                                                                                                        
        - Installation request for symfony/psr-http-message-bridge (locked at v1.0.0) -> satisfiable by symfony/psr-http-message-bridge[v1.0.0].                                                                       
        - dawson/amazon-ecs 1.0.0 requires symfony/psr-http-message-bridge 0.2 -> satisfiable by symfony/psr-http-message-bridge[v0.2].                                                                                
        - dawson/amazon-ecs 1.0.1 requires symfony/psr-http-message-bridge 0.2 -> satisfiable by symfony/psr-http-message-bridge[v0.2].                                                                                
        - dawson/amazon-ecs 1.0.2 requires symfony/psr-http-message-bridge 0.2 -> satisfiable by symfony/psr-http-message-bridge[v0.2].                                                                                
        - dawson/amazon-ecs 1.0.3 requires symfony/psr-http-message-bridge 0.2 -> satisfiable by symfony/psr-http-message-bridge[v0.2].                                                                                
        - Conclusion: don't install symfony/psr-http-message-bridge v0.2                                                                                                                                               
        - Installation request for dawson/amazon-ecs ^1.0 -> satisfiable by dawson/amazon-ecs[1.0.0, 1.0.1, 1.0.2, 1.0.3].  
    
    opened by Xoshbin 4
  • Added OfferFull for reading Price-History from amazon-ECS

    Added OfferFull for reading Price-History from amazon-ECS

    Hi,

    i hardcoded OfferFull into search and lookup. Please make the ResponsiveGroups more dynamic, so that we can set the ResponsiveGroups in our application.

    thx

    opened by mrandibilbao 4
  • Added searching by category

    Added searching by category

    Added support for searching by category. the usage should be like the code below if you want to search by a category, the name of the categories should be the same as written on Amazon and I think most of them there first letters are uppercase. $results = Amazon::search('Home Alone', 'Electronics')->json(); And if you didn't write the second parameter it will search in 'All' categories. I hope it's useful. Thanks

    opened by Xoshbin 3
  • Class 'App\Http\Controllers\Amazon' not found

    Class 'App\Http\Controllers\Amazon' not found

    I have the following method in a controller:

    public function add()
        {
            $product = Amazon::lookup('B004VLKY8M')->json();
            return $product;
    
        }
    

    and I'm getting a Class 'App\Http\Controllers\Amazon' not found

    I'm not sure what use statement to place in the controller file, I have tried use Amazon; use Dawson\AmazonECS\AmazonECS use Dawson\AmazonECS\Amazon and many more versons and get the same result.

    I have both Dawson\AmazonECS\AmazonECSServiceProvider::class, and 'Amazon' => Dawson\AmazonECS\AmazonECSFacade::class, in my config\app.php file in the correct place.

    can't figure out why I am getting this error.

    opened by mniblett 3
  • Suddenly getting 400 response (bad request)

    Suddenly getting 400 response (bad request)

    I've been running this package for about 1 year now. Suddenly (within the last month or two?) all amazon requests return a 400 response (bad request). Not sure if something changed in the API or if my keys were disabled or something?

    Any insight would be great! Thanks

    opened by brino 2
  • Call to an undefined method json()

    Call to an undefined method json()

    Hi,

    It seems like an amazing library for my use but I am facing the same issue that was reported earlier.

    I tried to check the of status by using "\Amazon::search('Home Alone')->getStatusCode()" and its giving me 400. Can you please check this out for me.

    Thanks in advance. :)

    duplicate 
    opened by wasifiqbal1990 2
  • Add page attribute to search

    Add page attribute to search

    Hi,

    I needed to include the ability to add pagination to my Amazon search results, I'm not sure my method is the best way but it is working for my use case (basically just submitting an optional "page" attribute with the request). I can submit a pull request, but this might be too much of a "quick and dirty" approach (code below).

    Thanks for your work on this package btw, it was really helpful in my project.

    public function search($query, $page = 1)
    	{
    		$query		= rawurlencode($query);
    		if ($page == 1) {
    			$params 	= $this->params(['Keywords' => $query, 'SearchIndex' => 'All', 'ResponseGroup' => $this->response_group]);
    		} else {
    			$params 	= $this->params(['Keywords' => $query, 'SearchIndex' => 'All', 'ResponseGroup' => $this->response_group, 'ItemPage'=>$page]);
    		}
    		$string 	= $this->buildString($params);
    		$signature 	= $this->signString($string);
    		$url 		= $this->url($params, $signature);
    
    		try {
    			$this->response = $this->client->get($url)->getBody();
    			return $this;
    		} catch(ClientException $e) {
    			return $e->getResponse();
    		}
    	}
    
    
    opened by robertem128 1
  • can't add more parameters

    can't add more parameters

    Dear @JoeDawson I already tried and I thought that I can add more parameters into the search method inside AmazonECS class like these lines below but it seems I can't,

    $params = $this->params(['Keywords' => $query, 'SearchIndex' => $category, 'ResponseGroup' => 'Images,ItemAttributes,Offers'**, 'Sort' => '-price']**);

    And I tried to retrieve all the items inside a category by bypassing the search query like below: $amazon_results = \Amazon::search('', 'Electronics')->json(); and that's not possible too.

    And I can't remove the search 'keyword' inside the search method when I think as I read it on the Amazon API manuals it's possible. $params = $this->params(['SearchIndex' => $category, 'ResponseGroup' => 'Images,ItemAttributes,Offers']);

    opened by Xoshbin 1
  • Signature error

    Signature error

    Hello,

    since this morning, without update the code, I have this error which is triggered by calling the method ->json ();

    <Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.</Message></Error>

    I already generated a new Amazon Api key but that does not change anything. An idea ? Thank you !

    opened by Sinepel 2
  • Call to undefined method json()

    Call to undefined method json()

    Doing a simple: $bookFromAmazon = Amazon::lookup($bookTitle)->json(); throws an error: Call to undefined method GuzzleHttp\Psr7\Response::json()do you have any idea why ?

    PS: ->xml()gives the same error

    bug 
    opened by isbkch 10
Releases(2.2.1)
Owner
Joe Dawson
Full stack web designer and developer, specialising in Laravel & WordPress.
Joe Dawson
This package tracks if products exist in Magento by storing the status locally in the DB.

Magento Products This package tracks if products exist in Magento by storing the status locally in the DB. We developed this to prevent multiple calls

JustBetter 14 Nov 11, 2022
A Laravel 8 and Livewire 2 demo showing how to search and filter by tags, showing article and video counts for each tag (Polymorphic relationship)

Advanced search and filter with Laravel and Livewire A demo app using Laravel 8 and Livewire 2 showing how to implement a list of articles and tags, v

SĂ©rgio Jardim 19 Aug 29, 2022
Simple CRUD + Search using Laravel 8 and Livewire 2

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

PowPow 11 Sep 29, 2022
SEO Helper is a package that provides tools and helpers for SEO (Search Engine Optimization).

SEO Helper By ARCANEDEV© SEO Helper is a package that provides tools and helpers for SEO (Search Engine Optimization). Feel free to check out the rele

ARCANEDEV 301 Nov 25, 2022
Laravel package to search through multiple Eloquent models.

Laravel package to search through multiple Eloquent models. Supports sorting, pagination, scoped queries, eager load relationships and searching through single or multiple columns.

Protone Media 845 Jan 1, 2023
Driver for Laravel Scout search package based on tntsearch

Driver for Laravel Scout search package based on https://github.com/teamtnt/tntsearch

TNT Studio 1k Dec 27, 2022
WIRECRUD 9 adalah aplikasi CRUD + Search sederhana yang dibuat menggukana Laravel 9 dan Livewire 2

WIRECRUD 9 adalah aplikasi CRUD + Search sederhana yang dibuat menggukana Laravel 9 dan Livewire 2. Demo bisa dilihat di YouTube Developow Terbuka jika ingin clone apliaksi sederhana ini untuk belajar, bisa ikuti cara-cara berikut ini.

DeveloPow 11 Nov 25, 2022
Laravel IndexNow - Submit webpage updates to search engines

Laravel IndexNow - Submit webpage updates to search engines This packages provides a wrapper to use the IndexNow api in Laravel. This makes indexing n

Laravel Freelancer NL 26 Dec 27, 2022
Send ping to search engine by Index now protocol.

Index now PHP protocol Easy to use protocol that websites can call to notify search engines whenever website contents on any URL is updated or created

Baraja packages 3 Sep 10, 2022
A site which you can apply jobs or search for employees with cool functionalities..

About App An App which you can apply jobs or search for employees with cool functionalities. Some Pics of App Click Image to Zoom in Sign In & Up Empl

Fatih Canbolat 1 Jan 7, 2022
Laravel Setting - Easily save, update and get titles, descriptions, and more. it is very easy to use.

Laravel Setting Easily save, update and get titles, descriptions, and more. it is very easy to use. This is great for storing and receiving general si

Ali Ranjbar 2 Aug 23, 2022
Easily add all the 58 Algerian Wilayas and its Dairas to your cool Laravel project (Migrations, Seeders and Models).

Laravel-Algereography Laravel-Algereography allows you to add Migrations, Seeders and Models of Algerian Wilayas and Dairas to your existing or new co

Hocine Saad 48 Nov 25, 2022
A Laravel Wrapper for the CoinDCX API. Now easily connect and consume the CoinDCX Public API in your Laravel apps without any hassle.

This package provides a Laravel Wrapper for the CoinDCX API and allows you to easily communicate with it. Important Note This package is in early deve

Moinuddin S. Khaja 2 Feb 16, 2022
Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.

Webdevetc BlogEtc - Complete Laravel Blog Package Quickly add a blog with admin panel to your existing Laravel project. It has everything included (ro

WebDevEtc. 227 Dec 25, 2022
Laravel-Mediable is a package for easily uploading and attaching media files to models with Laravel 5.

Laravel-Mediable Laravel-Mediable is a package for easily uploading and attaching media files to models with Laravel. Features Filesystem-driven appro

Plank Design 654 Dec 30, 2022
Easily capture every incoming request and the corresponding outgoing response in your Laravel app.

Easily capture every incoming request and the corresponding outgoing response in your Laravel app. This package is designed to work only with the Lara

Mark Townsend 22 Nov 15, 2022
Smeify is a Stable Automated Solution for Airtime and Data businesses in Nigeria, this package helps you integrate smeify easily into your laravel application.

Smeify is a Stable Automated Solution for Airtime and Data businesses in Nigeria, this package helps you integrate smeify easily into your laravel application.

Ogundiran Adewale Charles 2 Jul 27, 2022
Easily add Laravel Telescope and Horizon to Filament admin panel.

Filament Debugger This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. Installation You can inst

Stephen Jude 5 Nov 24, 2022
Laravel router extension to easily use Laravel's paginator without the query string

?? THIS PACKAGE HAS BEEN ABANDONED ?? We don't use this package anymore in our own projects and cannot justify the time needed to maintain it anymore.

Spatie 307 Sep 23, 2022