bestbuy/bestbuy

High level PHP client for the Best Buy API

v1.0.4 2017-09-08 04:21 UTC

This package is not auto-updated.

Last update: 2024-04-26 12:31:44 UTC


README

License Latest Stable Version Coverage Status Total Downloads

This is a high-level PHP client for the Best Buy developer API.

Getting Started

  1. Sign-up for a developer API Key at https://developer.bestbuy.com/
  2. 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 your composer.json file:

      "require": {
        "bestbuy/bestbuy": "^1.0"
      }
  3. 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']);

Documentation

Store Availability

$bby->availability(int|int[]|string $skus, int|int[]|string $stores, [array $responseConfig = []]);

  1. A single SKU/Store #
    $bby->availability(6354884, 611);
  2. An array of SKUs/Store #s
    $bby->availability([6354884, 69944141], [611, 281]);
  3. A valid query for SKUs/Stores
    $bby->availability('name=Star*', 'area(55347, 25)');

Product Categories

$bby->categories(string $search = '', [array $responseConfig = []]);

  1. All categories
    $bby->categories();
  2. A single category
    $bby->categories('cat00000');
  3. A query for categories
    $bby->categories('name=Home*');

Open Box Products

$bby->openBox(int|int[]|string $search = '', [array $responseConfig = []]);

  1. All open box products
    $bby->openBox();
  2. A single product
    $bby->openBox(6354884);
  3. An array of products
    $bby->openBox([6354884, 69944141]);
  4. A query
    $bby->openBox('category.id=cat00000');

Product Information

$bby->products(int|string $search = '', [array $responseConfig = []]);

  1. All products
    $bby->products();
  2. A single product
    $bby->products(6354884);
  3. A query for products
    $bby->products('name=Star*');

Product Recommendations

$bby->recommendations(string $type, int|string $categoryIdOrSku = null, [array $responseConfig = []]);

  1. Trending or Most Viewed products
    $bby->recommendations(\BestBuy\Client::RECOMMENDATIONS_TRENDING);
    $bby->recommendations(\BestBuy\Client::RECOMMENDATIONS_TRENDING, 'cat00000');
  2. Similar or Also Viewed products
    $bby->recommendations(\BestBuy\Client::RECOMMENDATIONS_SIMILAR, 6354884);

Product Reviews

$bby->reviews(int|string $search = '', [array $responseConfig = []]);

  1. All reviews
    $bby->reviews();
  2. A single review
    $bby->reviews(69944141);
  3. A query for reviews
    $bby->reviews('comment=purchase*');

Stores

$bby->stores(int|string $search = '', [array $responseConfig = []]);

  1. All stores
    $bby->stores();
  2. A single store
    $bby->stores(611);
  3. A query for stores
    $bby->stores('name=eden*');

Version

$bby->version();