Seller Center PHP SDK

LicenseLicense

Installation

The recommended way to install the SDK is through composer

Edit your composer.json to add the repository URL:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/LinioIT/seller-center-sdk.git"
    }
  ]
}

Then require the package:

Quick start

$ composer require linio/seller-center-SDK

Configuration

To interact with the Seller Center platform you need to ask for a UserID and API KEY and know the URL and version of the service you'll consume.

Those values will be used through a Configuration object as follows.

$configuration = new \Linio\SellerCenter\Application\Configuration('api-key-provided', 'api-username-provided', 'https://enviroment-seller-center-api.com', '1.0');

Accessing the functionalities

All the interaction with the platform will be guided through the SDK class SellerCenterSdk. To create it you need to provide a specific configuration and an HTTP Client.

$client = new \GuzzleHttp\Client();

$configuration = new \Linio\SellerCenter\Application\Configuration('api-key-provided', 'api-username-provided', 'https://enviroment-seller-center-api.com', '1.0');

$sdk = new \Linio\SellerCenter\SellerCenterSdk($configuration, $client);

Once you have the SDK instance you can access to all the functionalities group in a series of managers.

$result = $sdk->manager()->getSome();

If you want to retrieve all the available brands in Seller Center, you just need to use the Brand manager as follows:

$brandList = $sdk->brands()->getBrands();

Knowing the managers

Here is a list of the actual managers in the SDK:

Logging

The SDK accept a Logging interface that will use to register every request and response through your application and
Seller Center in DEBUG mode.

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

$logger = new Logger('myLogger');
$logger->pushHandler(new StreamHandler(__DIR__.'/sdk-log.log'));

$sellerCenterSdk = new SellerCenterSdk($configuration, $client, $logger);

Be very careful by using the SDK in debug mode, it will increase the size of log files very quickly. If you need to register every response, we recommend adding multiple log handlers.

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

$logger = new Logger('myLogger');
$logger->pushHandler(new StreamHandler(__DIR__.'/sdk-log.log', Logger::INFO));
$logger->pushHandler(new StreamHandler(__DIR__.'/sdk-log-debug.log', Logger::DEBUG));

$sellerCenterSdk = new SellerCenterSdk($configuration, $client, $logger);

Contributing

Feel free to send your contributions as a PR. Make sure to fulfill the followings items.