hitmeister / api-sdk
Kaufland.de onlineshop API SDK for PHP
Installs: 110 520
Dependents: 0
Suggesters: 0
Security: 0
Stars: 23
Watchers: 14
Forks: 28
Open Issues: 20
Requires
- php: >=5.4.0
- ext-curl: *
- ext-json: *
- guzzlehttp/ringphp: ^1.1
- psr/log: ^1.0
Requires (Dev)
- memio/memio: ^1.1
- mockery/mockery: ^0.9.4
- php-coveralls/php-coveralls: ^1.1
- phpunit/phpunit: ^4.8
Suggests
- monolog/monolog: Allows more advanced logging of the application flow
- dev-develop
- 1.54.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.36.0
- 1.35.1
- 1.35.0
- 1.34.1
- 1.33.1
- 1.33.0
- 1.32.0
- 1.31.1
- 1.30.1
- 1.28.0
- 1.26.1
- 1.26.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.19.2
- 1.19.1
- 1.19.0
- 1.17.3
- 1.17.2
- 1.17.1
- 1.17.0
- 1.16.0
- 1.15.0
- 1.13.4
- 1.13.3
- 1.13.2
- 1.13.1
- 1.13.0
- 1.11.1
- 1.11.0
- 1.7.0
- 1.6.0
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1
- dev-PTA-45-remove-bookings-report-for-old-business-model
- dev-COL-3032-update-sdk
- dev-SLD-803-add-new-carrier-constants
- dev-SLM-664_accept_custom_user_agent
- dev-SLD-711-add-new-carriers
- dev-SLD-343-change-real-to-kaufland
- dev-sld-427-add-postnl-3s-and-other-carriers
- dev-PD-2145-fix-type-of-ean-uri-param-to-be-string
- dev-DLV-322_add_new_carriers
- dev-abdul-jabbar01_DLV-321_Fix-mimio-object-issue
- dev-update-item-fields
- dev-INV-170-api-sdk
- dev-add-ShipmentInformationTransfer-to-OrderUnitShipmentTransfer
- dev-master
- dev-PD-780-change-shop-api-for-zombies
- dev-add-delivery_time_min-to-order-units
- dev-revert-56-develop
- dev-rename-delivery-time-expires
This package is auto-updated.
Last update: 2024-10-25 14:16:25 UTC
README
PHP client for Kaufland.de Onlineshop API.
Install
Via Composer
$ composer require hitmeister/api-sdk
Via GitHub
$ git clone git@github.com:hitmeister/api-sdk-php.git
Quickstart
This section will give you a quick overview of the client and how the major functions work.
Create client
Before starting, you will need the API keys from your API settings page. Also please provide the name of your partner solution name to the setUserAgent() field.
Include the autoloader in your main project (if you haven’t already), and instantiate a new client.
require 'vendor/autoload.php'; use Hitmeister\Component\Api\ClientBuilder; $client = ClientBuilder::create() ->setClientKey('YOUR_CLIENT_KEY') ->setClientSecret('YOUR_CLIENT_SECRET') ->setUserAgent('YOUR_USER_AGENT') ->build();
Namespaces overview
The client has a number of "namespaces", which generally expose API functionality. The namespaces correspond to the various API endpoints. This is a complete list of namespaces:
Retrieve the categories data
You can search for categories:
$categories = $client->categories()->find('handy'); foreach ($categories as $category) { echo "Category ID: {$category->id_category}\n"; echo "Category Name: {$category->name}\n"; }
Or get the information about one of them:
$category = $client->categories()->get(1); echo "Category ID: {$category->id_category}\n"; echo "Category Name: {$category->name}\n";
Retrieve the product data
Search for items:
$items = $client->items()->find('iphone'); foreach ($items as $item) { $eans = implode(',', $item->eans); echo "Item ID: {$item->id_item}\n"; echo "Category ID: {$item->id_category}\n"; echo "Title: {$item->title}\n"; echo "EANs: {$eans}\n"; }
Also you can find the items by EAN:
$items = $client->items()->findByEan('0885909781652');
Send inventory data
According to the API documentation you have two options:
To upload your product data as CSV file
// Post the task to import your file. You will have the ID of the task. $importFileId = $client->importFiles() ->post('http://www.example.com/my_products.csv', 'PRODUCT_FEED'); // Retrieve the information about your task $data = $client->importFiles()->get($importFileId); echo "URL: {$data->uri}\n"; echo "Status: {$data->status}\n";
To update a single unit
// $result will be true or false $result = $client->units()->update(10, ['condition' => 'new']);
Testing
$ composer test
License
The MIT License (MIT). Please see License File for more information.