PHP code example of sapientpro / ebay-browse-sdk-php

1. Go to this page and download the library: Download sapientpro/ebay-browse-sdk-php 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/ */

    

sapientpro / ebay-browse-sdk-php example snippets



use SapientPro\EbayBrowseSDK\Configuration;
use SapientPro\EbayBrowseSDK\Api\ItemApi;
use SapientPro\EbayBrowseSDK\Models\CompatibilityPayload;

// Configure OAuth2 access token for authorization: api_auth
$config = Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new ItemApi(
config: $config
);
// you can create and fill a Model class that implements EbayModelInterface using fromArray() method
// exception will be thrown if a property does not exist in the model class
$body = CompatibilityPayload::fromArray([]);

try {
$result = $apiInstance->checkCompatibility($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling InventoryItemApi->bulkCreateOrReplaceInventoryItem: ', $e->getMessage(), PHP_EOL;
}

Item::fromArray([
    'price' => ConvertedAmount::fromArray([
        'value' => '6.90',
        'currency' => CurrencyCodeEnum::USD
    )]
])

Item::fromPlainArray([
    'price' => [
        'value' => '6.90',
        'currency' => CurrencyCodeEnum::USD
    ]
])

Item::fromJson('{"price": {"value": "6.90", "currency": "USD"}}')