PHP code example of shoppingfeed / php-sdk

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

    

shoppingfeed / php-sdk example snippets



namespace ShoppingFeed\Sdk;

// Setup credentials to connect to the API, and create session
$credential = new Credential\Token('api-token');
/** @var \ShoppingFeed\Sdk\Api\Session\SessionResource $session */
$session = Client\Client::createSession($credential);

/** @var \ShoppingFeed\Sdk\Api\Session\SessionResource $session */
$store = $session->selectStore(1276);
$store->getName(); // test-store
$store->getId(); // 1276
// ... and so on

/** @var \ShoppingFeed\Sdk\Api\Session\SessionResource $session */
// Get store collection
$stores = $session->getStores();
// Count the number of stores [int]
$stores->count();
// Get a particular store
$store = $stores->select('id-or-store-name');
// Loop over available stores
foreach ($stores as $store) {
    $store->getName(); 
}
bash
    composer