PHP code example of pricemotion / sdk

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

    

pricemotion / sdk example snippets


use Symfony\Component\Cache\Adapter\FilesystemAdapter;

$cache = new FilesystemAdapter();

use Pricemotion\Sdk\Crypto\SignatureVerifier;
use Pricemotion\Sdk\Api\WebhookRequestFactory;

$body = file_get_contents('php://input');

$signatureVerifier = new SignatureVerifier($cache);
$webhookRequestFactory = new WebhookRequestFactory($signatureVerifier);
$webhookRequest = $webhookRequestFactory->createFromRequestBody($body);
$product = $webhookRequest->getProduct();

$product->getEan()->toString();

$product->getName();

$product->getLowestPrice();
$product->getAveragePrice();
$product->getMedianPrice();
$product->getHighestPrice();

foreach ($product->getOffers() as $offer) {
  $offer->getSeller();
  $offer->getPrice();
}