This is a high-level PHP client for the Best Buy developer API.
- Sign-up for a developer API Key at https://developer.bestbuy.com/
- Install the package
-
Using the command line
composer require bestbuy/bestbuy
-
Using
composer.json
Add"bestbuy/bestbuy": "^1.0"
inside of the require part of yourcomposer.json
file:"require": { "bestbuy/bestbuy": "^1.0" }
-
- Use the package. There are several ways to provide the key to the
Client
:- Set an environment variable of
BBY_API_KEY
to your key and invoke the method
$bby = new \BestBuy\Client();
- Send the key in as a string when invoking the method
$bby = new \BestBuy\Client('YOURKEY');
- Send the key in as part of an object when invoking the method
$bby = new \BestBuy\Client(['key' => 'YOURKEY']);
- Set an environment variable of
- Store Availability
- Product Categories
- Open Box Products
- Product Information
- Product Recommendations
- Product Reviews
- Stores
- Version
- A single SKU/Store #
$bby->availability(6354884, 611);
- An array of SKUs/Store #s
$bby->availability([6354884, 69944141], [611, 281]);
- A valid query for SKUs/Stores
$bby->availability('name=Star*', 'area(55347, 25)');
- All categories
$bby->categories();
- A single category
$bby->categories('cat00000');
- A query for categories
$bby->categories('name=Home*');
- All open box products
$bby->openBox();
- A single product
$bby->openBox(6354884);
- An array of products
$bby->openBox([6354884, 69944141]);
- A query
$bby->openBox('category.id=cat00000');
- All products
$bby->products();
- A single product
$bby->products(6354884);
- A query for products
$bby->products('name=Star*');
$bby->recommendations(string $type, int|string $categoryIdOrSku = null, [array $responseConfig = []]);
- Trending or Most Viewed products
$bby->recommendations(\BestBuy\Client::RECOMMENDATIONS_TRENDING);
$bby->recommendations(\BestBuy\Client::RECOMMENDATIONS_TRENDING, 'cat00000');
- Similar or Also Viewed products
$bby->recommendations(\BestBuy\Client::RECOMMENDATIONS_SIMILAR, 6354884);
- All reviews
$bby->reviews();
- A single review
$bby->reviews(69944141);
- A query for reviews
$bby->reviews('comment=purchase*');
- All stores
$bby->stores();
- A single store
$bby->stores(611);
- A query for stores
$bby->stores('name=eden*');