PHP code example of jhoffland / natec-php-sdk

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

    

jhoffland / natec-php-sdk example snippets


use NatecSdk\Client;
use NatecSdk\Resources\Types\AssortmentUpdateType;
use NatecSdk\Resources\AssortmentUpdate;
use NatecSdk\Resources\Invoice;
use NatecSdk\Resources\Shipment;

$apiToken = 'xxx';
$client = new Client($apiToken);

// Get an iterator with all resources, matching the filter (query).
$assortmentUpdates = AssortmentUpdate::get($client, [
    'type' => AssortmentUpdateType::PRODUCT_EXPECTED_ARRIVAL->value
]);

foreach($assortmentUpdates as $assortmentUpdate) {
    var_dump($assortmentUpdate);
}

// Get one resource, by the primary key value (id). The primary key for e.g. invoices is documentNo.
var_dump(Invoice::find($client, 'GVFN22-12345'));

// Save an order confirmation PDF file.
$confirmationFile = fopen(__DIR__ . sprintf('/confirmation-%s.pdf', $order->no), 'w+');
$order->confirmation($client, $confirmation);

// Make an API request
var_dump($client->get(Shipment::endpoint()));
var_dump($client->post('/orders', [ 'reference' => 'Example order' ]));