double-break / noverstock-php-sdk
Simple SDK for connecting to Noverstock API
dev-main
2024-07-17 16:06 UTC
Requires
- guzzlehttp/guzzle: ^7.8
This package is auto-updated.
Last update: 2024-11-17 16:52:28 UTC
README
composer require double-break/noverstock-php-sdk
Usage
Orders Client
<?php use DoubleBreak\Noverstock\Sdk\ClientFactory; require __DIR__ . '/../vendor/autoload.php'; $factory = new ClientFactory([ 'actor' => [ 'type' => 'APP', 'authToken' => 'eyJ0eX...ug2vk' ] ]); $client = $factory->createClient('Orders'); $result = $client->getOrder('order-uuid'); print_r($result['order']);
Generic Client
use DoubleBreak\Noverstock\Sdk\ClientFactory; require __DIR__ . '/../vendor/autoload.php'; $factory = new ClientFactory([ 'actor' => [ 'type' => 'APP', 'authToken' => 'eyJ0eX...ug2vk' ] ]); $client = $factory->createClient('Generic'); $result = $client->request('GET', '/orders-api/orders/{uuid}', [ 'path' => [ 'uuid' => 'order-uuid' ] ]); print_r($result['order']);
Connecting to Test Environment
use DoubleBreak\Noverstock\Sdk\ClientFactory; require __DIR__ . '/../vendor/autoload.php'; $factory = new ClientFactory([ 'domain' = 'test.noverstock.tech' 'actor' => [ 'type' => 'APP', 'authToken' => 'eyJ0eX...ug2vk' ] ]); $client = $factory->createClient('Orders'); $result = $client->getOrder('order-uuid'); print_r($result['order']);