|
1 | 1 | # Amazon ECS for Laravel
|
2 | 2 |
|
3 |
| -This is currently a work in progress, if you come across this as it is right now - **please use your own risk**. |
| 3 | +Whilst working on a project, I need the ability to search for products on Amazon as well as lookup individual products based on their ASIN which led me to make a dedicated package for that as *sometimes*, the process to authorise with Amazon is a little awkward. To say the least. |
4 | 4 |
|
5 |
| -Documentation will be updated tomorrow (as of this commit). |
| 5 | +## Installation |
6 | 6 |
|
7 |
| -### Planned |
| 7 | +``` |
| 8 | +composer require dawson/amazon-ecs |
| 9 | +``` |
8 | 10 |
|
9 |
| -- [ ] Finish Documentation |
| 11 | +After you have successfully installed, add the follow Service Provider and Facade to your `config/app.php`. |
| 12 | + |
| 13 | +``` |
| 14 | +Dawson\AmazonECS\AmazonECSServiceProvider::class, |
| 15 | +``` |
| 16 | + |
| 17 | +``` |
| 18 | +'Amazon' => Dawson\AmazonECS\AmazonECSFacade::class |
| 19 | +``` |
| 20 | + |
| 21 | +Now we'll go ahead and publish the `amazon.php` configuration file. |
| 22 | + |
| 23 | +``` |
| 24 | +php artisan vendor:publish --provider="Dawson\AmazonECS\AmazonECSServiceProvider" |
| 25 | +``` |
| 26 | + |
| 27 | +Open up the `amazon.php` configuration file and enter your credentials or leverage the use of environment variables which're used by default. |
| 28 | + |
| 29 | +When it comes to choosing a `locale`, you have a choice of the following: |
| 30 | + |
| 31 | +|Locale |Country | |
| 32 | +|----------|------------------| |
| 33 | +|`co.uk` |United Kingdom | |
| 34 | +|`com` |United States | |
| 35 | +|`ca` |Canada | |
| 36 | +|`com.br` |Brazil | |
| 37 | +|`de` |Germany | |
| 38 | +|`es` |Spain | |
| 39 | +|`fr` |France | |
| 40 | +|`in` |India | |
| 41 | +|`co.jp` |Japan | |
| 42 | +|`com.mx` |Mexico | |
| 43 | + |
| 44 | +**You should now be correctly configured!** |
| 45 | + |
| 46 | +## Usage |
| 47 | + |
| 48 | +Currently, there are two methods available which are `search` and `lookup`. |
| 49 | + |
| 50 | +### Search |
| 51 | + |
| 52 | +``` |
| 53 | +$response = Amazon::search('Home Alone'); |
| 54 | +``` |
| 55 | + |
| 56 | +**It's that simple!** The request should return an XML response. |
| 57 | + |
| 58 | + |
| 59 | +*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. |
| 60 | + |
| 61 | +### Lookup |
| 62 | + |
| 63 | +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: |
| 64 | + |
| 65 | +``` |
| 66 | +$product = Amazon::product('B004VLKY8M'); |
| 67 | +
|
| 68 | +``` |
| 69 | + |
| 70 | +This will simply return the product, it's attributes and item links. |
| 71 | + |
| 72 | +## Questions & Issues |
| 73 | + |
| 74 | +Should you have any questions or come across a problem, please feel free to submit an issue. |
| 75 | + |
| 76 | +--- |
| 77 | + |
| 78 | +## Planned |
| 79 | + |
| 80 | +- [X] Finish Documentation |
10 | 81 | - [X] Locales
|
11 | 82 | - [ ] Better Exception Handling
|
12 | 83 | - [ ] Cart abilities, such as modifying, adding, clearing etc.
|
|
0 commit comments