A PHP SDK for the Shopware 5 REST API.
Code information:
Package information:
composer require leadcommerce/shopware-sdk
See API Docs
<?php
require 'vendor/autoload.php';
// Create a new client
$client = new ShopwareClient('http://shopware.dev/api/', 'user', 'api_key');
// Fetch all articles
$articles = $client->getArticleQuery()->findAll();
// Fetch one article by id
$article = $client->getArticleQuery()->findOne(1);
// Create an article
$article = new Article();
$article->setName("John product doe");
$article->setDescription("Lorem ipsum");
// ... <- more setters are required
$client->getArticleQuery()->create($article);
// Update article
$article->setName("John product doe");
$updatedArticle = $client->getArticleQuery()->update($article);
// Update multiple articles
$articleOne = $client->getArticleQuery()->findOne(1);
$articleOne->setName("John product doe");
$articleTwo = $client->getArticleQuery()->findOne(2);
$articleTwo->setName("John product doe 2");
$articles = $client->getArticleQuery()->updateBatch([$articleOne, $articleTwo]);
// Delete an article
$client->getArticleQuery()->delete(1);
// Delete multiple articles at once
$client->getArticleQuery()->deleteBatch([1, 2, 3]);
?>
Here is the issue tracker.
- Read the Code of Conduct
- Write some code
- Write some tests