Skip to content

LinkerCloud/linker-api-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linker API Client

PHP Library to access Linker Public API.

Build Status: Build Status

Installation

Install composer require linker/api-client

Create instance

use GuzzleHttp\Client;
use JMS\Serializer\SerializerBuilder;
use Linker\Api\Client\HttpApiClient;

$uri     = 'https://api.test.linker.shop/public-api/v1';
$apiKey  = 'api123';    
$client  = new Client();
//JMS Serializer
$serializer = SerializerBuilder::create()->build();
    
$client = new HttpApiClient($client, $serializer, $uri, $apiKey);

Features

Get order list

$result = $client->getOrders();

Get order

$result = $client->getOrder('orderId');  

Create order

$order = new Order();
$order->setClientOrderNumber('abcd');
$order->setOrderDate(new \DateTime());
$order->setCarrier('DHL');
$order->setDeliveryCountry('PL');
$order->setDeliveryPostCode('10-234');
$order->setDeliveryCity('Warsaw');
$order->setDeliveryStreet('Test Street');
$order->setDeliveryEmail('[email protected]');
$order->setDeliveryRecipient('Joh Snow');
$result = $client->createOrder($order);

Get stock list

$result = $client->getStocks();

Testing

Unit tests are in tests/unit you can run it by running following command phpunit tests/unit