uam/amazon-search-bundle
UAM Amazon Search Bundle is a Symfony bundle that wraps Amazon Product Advertising API search, letting you query products by keyword and render results in your templates through configurable bundle settings. It has no stars or visibility, so vet maintenance before adopting.
composer require uam/amazon-search-bundle. Expect dependency resolution to fight you: this is a Symfony 2.x bundle, so its composer.json almost certainly pins symfony/* to ~2.x and an old PHP range. In a modern Laravel app you will likely need --ignore-platform-reqs or a fork with relaxed constraints.vendor/uam/amazon-search-bundle and read, in this order:
*Bundle.php class (the bundle name and namespace),Resources/config/services.yml (service IDs and constructor arguments),DependencyInjection/*Extension.php (the config keys you can set),Controller/ or *Search*.php class (the actual entry point).// app/Services/AmazonSearch.php
class AmazonSearch
{
public function search(string $term): array
{
$client = new \UAM\AmazonSearchBundle\...\Search(...);
return $client->search($term); // whatever the bundle exposes
}
}
// routes/web.php
Route::get('/search', fn () => app(AmazonSearch::class)->search(request('q')));
Wrap it in a service provider. Bind the bundle's search class as a singleton in AppServiceProvider (or a dedicated provider) and translate the bundle's YAML config into Laravel config values. This isolates every use UAM\... statement to one file, so a future fork or replacement is a one-line change.
$this->app->singleton(AmazonSearch::class, function ($app) {
return new AmazonSearch(config('services.amazon_search'));
});
Cache aggressively. Amazon search pages are slow and rate-limited. Wrap the call:
return Cache::remember("amazon:search:{$term}", now()->addHours(6), fn () =>
$this->amazon->search($term)
);
Push bulk searches onto a queue. A job per search term, with RateLimited middleware or a sleep, keeps you from hammering Amazon and getting blocked. Store raw responses so you can re-parse without re-fetching.
Normalize the output behind your own contract. Define a ProductSearch interface (search(string $term): Collection) and make the bundle an implementation. This gives you a seam for tests, a fake, and an escape hatch when the scraper breaks.
Use a console command for scheduled work. php artisan amazon:search {term} is far more convenient for debugging than a browser route, and it lets you dump raw HTML to storage/app/amazon/ for inspection.
Test with fixtures. Because the bundle likely produces HTML, capture a real response once and assert your parser against the fixture — never hit Amazon in the test suite.
symfony/* and PHP constraints will conflict with Laravel. Options: --ignore-platform-reqs, a local fork with loosened constraints, or vendoring just the search class out of the bundle. The last is often cleanest for a 0-star, 0-dependent package.each(), or removed reflection behavior. Run it under a pinned runtime or refactor.uam_amazon_search) and nested keys. Mirror them exactly in a Laravel config array rather than trying to load the bundle's YAML through Laravel's config system.How can I help you explore Laravel packages today?