Skip to content

Vleks/sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vleks SDK for PHP

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock

Installation

It's recommended that you use Composer to install the SDK.

composer require vleks/sdk

This will install the Vleks SDK.
PHP 5.6 or newer is required.

Usage

Create an index.php file with the following contents:

<?php
use Vleks\SDK\Client;
use Vleks\SDK\Requests\ListProducts as ListProductsRequest;
use Vleks\SDK\Exceptions\ClientException;
use Vleks\SDK\Exceptions\ServiceException;

require 'vendor/autoload.php';

$publicKey  = '-- YOUR PUBLIC KEY --';
$privateKey = '-- YOUR PRIVATE KEY --';
$merchantId = '-- YOUR MERCHANT ID --';
$clusterUrl = '-- YOUR CLUSTER URL --'

$vleksClient = new Client($publicKey, $privateKey, $merchantId, $clusterUrl);

try {
    $request = new ListProductsRequest();
    $result  = $vleksClient->listProducts($request);

    print_r ($result->getProducts());
} catch (ClientException $clientException) {
    echo 'A Client error occurred: ' . $clientException->getMessage();
} catch (ServiceException $servicException) {
    echo 'A Service error occurred: ' . $servicException->getMessage();
}

See the contents of the examples directory for more information.

Tests

To execute the test suite, you'll need PHPUnit.

$ phpunit

License

The Vleks SDK for PHP is licensed under the MIT licence.
See the license file for more information.