jtl / fulfillment-sdk
This package is abandoned and no longer maintained.
The author suggests using the jtl/fulfillment-api-sdk package instead.
JTL-Fulfillment Netzwerk SDK project.
1.0.13
2018-03-21 10:21 UTC
Requires
- php: >=5.6.4
- guzzlehttp/guzzle: ^6.2.3
- hassankhan/config: ^0.11.2
- illuminate/log: ^5.4.27
- illuminate/support: ^5.4.19
- jtl/fulfillment-sdk-entities: ^1.0
- nesbot/carbon: ^1.23.0
README
Requirements
- PHP 5.6
- Composer
- Git
Initial Setup
git clone git@gitlab.jtl-software.de:Fulfillment/sdk.git
chown -R www-data:www-data ./sdk
composer install --no-dev
Using
Rest API URL
https://fulfillment.jtl-software.de/ext/v1/
List of products
use Jtl\Fulfillment\Sdk\Controller\ControllerType;
$client = new \Jtl\Fulfillment\Sdk\Client('<fulfillment_rest_api_url>', '<your_api_token>');
/** @var \Jtl\Fulfillment\Sdk\Entities\v1\ProductCollection $collection */
$collection = $client->controller(ControllerType::PRODUCT)->page(1)->perPage(20)->findAll();
Single product
use Jtl\Fulfillment\Sdk\Controller\ControllerType;
$client = new \Jtl\Fulfillment\Sdk\Client('<fulfillment_rest_api_url>', '<your_api_token>');
/** @var \Jtl\Fulfillment\Sdk\Entities\v1\Product $product */
$product = $client->controller(ControllerType::PRODUCT)->find('<product_primary_key>');
Create or update product
use Jtl\Fulfillment\Sdk\Controller\ControllerType;
$client = new \Jtl\Fulfillment\Sdk\Client('<fulfillment_rest_api_url>', '<your_api_token>');
$product = (new \Jtl\Fulfillment\Sdk\Entities\v1\Product())
->setName('Test')
->setSku('aaw8')
->setLength(1.2)
->setHeight(3.4)
->setWidth(5.0)
->setProductWeight(3.3)
->setShippingWeight(4.1)
->setManufacturerNumber('Test-aaw8')
->setVat(19.0)
->setCategories(['<category_primary_key>']);
/** @var \Jtl\Fulfillment\Sdk\Entities\v1\Product $product */
$product = $client->controller(ControllerType::PRODUCT)->save($product);
Add product picture
use Jtl\Fulfillment\Sdk\Controller\ControllerType;
$client = new \Jtl\Fulfillment\Sdk\Client('<fulfillment_rest_api_url>', '<your_api_token>');
/** \Jtl\Fulfillment\Sdk\Entities\v1\Picture $picture */
$picture = $client->controller(ControllerType::PRODUCT)->savePicture(
'<product_primary_key>',
(new \Jtl\Fulfillment\Sdk\Entities\v1\Picture())
->setData(base64_encode(file_get_contents('<path_to_picture_file_>')))
);
Delete product picture
use Jtl\Fulfillment\Sdk\Controller\ControllerType;
$client = new \Jtl\Fulfillment\Sdk\Client('<fulfillment_rest_api_url>', '<your_api_token>');
$result = $client->controller(ControllerType::PRODUCT)->deletePicture('<product_primary_key>', '<picture_primary_key>');
Delete product
use Jtl\Fulfillment\Sdk\Controller\ControllerType;
$client = new \Jtl\Fulfillment\Sdk\Client('<fulfillment_rest_api_url>', '<your_api_token>');
$result = $client->controller(ControllerType::PRODUCT)->delete('<product_primary_key>');