PHP code example of koenreiniers / bol-sdk

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

    

koenreiniers / bol-sdk example snippets


use \Kr\Bol\Plaza;
use \Kr\Model\Offer;

$plaza = new Plaza($publicKey, $privateKey);
// Create an offer
// Note you can also create an Offer model the old fashioned way using getters/setters
$offer = Offer::toCreate($id, $ean, $condition, $price, $deliveryCode, $quantityInStock, $publish, $referenceCode, $description);
$plaza->createOffer($offer);

// Update an offer
$offer = Offer::toUpdate($id, $price, $deliveryCode, $publish, $referenceCode, $description);
$plaza->updateOffer($offer);

// Update an offer's stock
$offer = Offer::toUpdate($id, $quantityInStock);
$plaza->updateOfferStock($offer);
// Alternatively:
$plaza->updateOfferStock($id, $quantityInStock);

// Delete an offer
$offer = Offer::toDelete($id);
$plaza->deleteOffer($offer);
// Alternatively:
$plaza->deleteOffer($id);

// Request an export of your offers
$exportFilename = $plaza->requestExport($filter);
// Try to read an export
$offers = $plaza->readExport($exportFilename);

use \Kr\Bol\Http\PlazaClient;

$plazaClient = new PlazaClient($publicKey, $privateKey);
$plazaClient->get("/offers/v1");
$plazaClient->post("/offers/v1", $content);
$plazaClient->put("/offers/v1", $content);
$plazaClient->delete("/offers/v1");

use \Kr\Bol\Enum\Condition;
use \Kr\Bol\Enum\DeliveryCode;

$conditions = Condition::all();
$deliveryCodes = DeliveryCode::all();


$headerGenerator = new \Kr\Bol\Http\HeaderGenerator();
$headers = $headerGenerator->generateHeaders($publicKey, $privateKey, $target, $method);