It is an official PHP SDK for Yuppim PHP API v1.
In order to use this library you need to have at least PHP 7.0 version.
There are two ways to use Yuppim PHP SDK:
Use Composer
You will need to download Yuppim PHP SDK using Composer:
composer require alekseon/yuppim-api-v1-php-sdk
If you are not familiar with Composer, learn about it here.
In the given example you will see how to initiate selected API and a actions which are available:
- Get single product by ID
- Get array of products
// get single product
$productApi = (new \YuppimApi\Yuppim('your-token'))->product();
$product = $productApi->get($productId);
// get all of products, deafult limit is 100 products in one response
$productsApi = (new \YuppimApi\Yuppim('your-token'))->products();
$products = $productsApi->get();
// get products with pagination
$productsApi = (new \YuppimApi\Yuppim('your-token'))->products();
$productsApi->setLimit($limit);
$productsApi->setPage($page);
$products = $productsApi->get();
// get products filtered
$productsApi = (new \YuppimApi\Yuppim('your-token'))->products();
$productsApi->addFilter($field, $operator, $value);
$products = $productsApi->get();
Fields allowed to filter are:
- Nazwa
- Nazwa_lub_identyfikator
- Numer_katalogowy
- Cena_obowiazuje_od
- Data_dodania
- Data_modyfikacji
- Producent
- Dostawca
The supported operators are:
- "="
- ">"
- "<"
- "!="
- "IN"
- "CONTAINS"
- "STARTS WITH"
- "MATCH"
Note: Not all operators are available for all reference fileds.
// get products filtered example
$productsApi = (new \YuppimApi\Yuppim('your-token'))->products();
$productsApi->addFilter('Data_dodania', '>', '2020-01-01 00:00:00');
$productsApi->addFilter('Dostawca', 'IN', ['Dostawca_X', 'Dostawca_Y']);
$product = $productsApi->get();
In case you find any bugs, submit an issue directly here in GitHub.