The recommended way to install the SDK is through composer
We have a new version to support Falabella and Linio platform, please use and follow instructions of README from branch gsc-master
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:
$ composer require linio/seller-center-sdk
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');
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 optionally a HTTP Client.
Note: We support HTTP Client for Guzzle v6 higher or any PSR7 HTTP Client.
- If you want to use Guzzle v5 you MUST install as dependency
php-http/guzzle5-adapter
And You MUST NOT pass a client into constructor.- For Guzzle v6 take it in consideration.
- If you are using Guzzle v6 and passing a client into constructor you don't need any dependency.
- If you are using Guzzle v6 and not passing a client into constructor you will need a
php-http/guzzle6-adapter
dependency.
$client = new Client(); // Guzzle >= v6 only or a PSR7 HTTP 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);
Note:
- case Guzzle v5
$ composer require php-http/guzzle5-adapter
- case Guzzle v6
$ composer require php-http/guzzle6-adapter
- For PSR7 HTTP Client no further more dependency is required.
$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);
One 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();
Here is a list of the actual managers in the SDK:
- BrandManager
- CategoryManager
- DocumentManager
- FeedManager
- OrderManager
- ProductManager
- QualityControlManager
- WebhookManager
- Shipment
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);
Feel free to send your contributions as a PR. Make sure to fulfill the followings items.