PHP code example of dotsplatform / catalog-api-sdk

1. Go to this page and download the library: Download dotsplatform/catalog-api-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dotsplatform / catalog-api-sdk example snippets


use Dotsplatform\CatalogApiSdk\Client\CatalogClient;
use Dotsplatform\CatalogApiSdk\DTO\Params\CatalogAuthContext;
use Dotsplatform\CatalogApiSdk\DTO\Params\CatalogBatchParams;

$auth = CatalogAuthContext::fromArray([
    'accountId' => $accountId,
    'companyId' => $companyId,
    'companyAddressId' => $addressId,
    'headers' => [
        'X-Internal-Gateway-Token' => config('catalog.internal_gateway_token'),
        'Idempotency-Key' => $key,
    ],
]);

$result = app(CatalogClient::class)->upsertItems($auth, CatalogBatchParams::fromArray([
    'items' => [$row1, $row2],
]));
$result->getBatchId();