PHP code example of setono / peak-wms-php-sdk

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

    

setono / peak-wms-php-sdk example snippets



use Setono\PeakWMS\Client\Client;
use Setono\PeakWMS\DataTransferObject\Address;
use Setono\PeakWMS\DataTransferObject\SalesOrder\OrderLine\SalesOrderLine;
use Setono\PeakWMS\DataTransferObject\SalesOrder\SalesOrder;

$client = new Client('your_api_key');

$salesOrder = new SalesOrder(
    orderId: 'order_in_your_store',
    forwarderProductId: 'usually_your_shipping_method_id',
    orderNumber: 'order_number_in_your_store',
    billingAddress: new Address(
        customerName: 'John Doe',
        address1: 'Hobrovej 1',
        postalCode: '9000',
        city: 'Aalborg',
        country: 'DK',
        email: '[email protected]',
        phone: '33762234',
    ),
);

$salesOrder->orderLines[] = new SalesOrderLine(
    orderLineId: 'order_line_id_in_your_store',
    quantityRequested: 1,
    productId: 'BLUE_TSHIRT-L',
);
$client->salesOrder()->create($salesOrder);



use CuyZ\Valinor\Cache\FileSystemCache;
use Setono\PeakWMS\Client\Client;

PI_KEY');
$client->getMapperBuilder()->withCache($cache);