skuio / sku-sdk
SKU.io User API.
v0.6.12.8
2024-01-14 03:40 UTC
Requires
- php: >=7.1
- ext-curl: *
- ext-json: *
- nesbot/carbon: ^2.32
Requires (Dev)
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2026-08-07 22:02:38 UTC
README
A PHP package to connect to sku.io User API.
Table of contents
Installation
Installation using composer:
composer require skuio/sku-sdk
Usage
-
You need to create or get user API credentials from this APIs User API
This APIs return
{ "key": "f6a9f775f414ecc550a....", "secret": "0a9be418866a453cb9...." } -
Use this credentials to connect with sku.io user api (
username,password). -
Set the SDK configurations:
- username
- password
- environment
you can set
urlordev_urlif you want to change your testing domains. -
the SDK handle response automatically and you code get the results using these three functions:
getCode(): returns http response status of i.e (200,500 ..).getResponse(): returns the JSON format response (response also return errors like validation errors ..etc).getCurlError(): returns thecurlerror.
Example Usage
Here is an example of a function used to get products from sku.io:
use Skuio\Sdk\Sdk; use Skuio\Sdk\Request; use Skuio\Sdk\Resource\Products; public function getProducts() { Sdk::config( [ 'username' => $username, 'password' => $password, 'environment' => Sdk::DEVELOPMENT ] ); $productsRequest = new Request(); $productsRequest->setConjunction( 'and' ); $productsRequest->addFilter( 'sku', '=', '5333180491623' ); $productsRequest->setLimit( 15 ); $productsRequest->setPage( 1 ); $products = new Products(); $products = $products->get( $productsRequest ); return $products->getResponse(); }
And you can use the base Sdk class
use Skuio\Sdk\Sdk; public function testConnection() { Sdk::config( [ 'username' => $username, 'password' => $password, 'environment' => Sdk::DEVELOPMENT ] ); $sdk = new Sdk(); $res = $sdk->authorizedRequest( '/vendors' ); return $res->getResponse(); }