leadcommerce/shopware-sdk

This package is abandoned and no longer maintained. No replacement package was suggested.

A PHP SDK for the Shopware 5 REST API.

1.0.2.1 2017-01-26 19:52 UTC

This package is not auto-updated.

Last update: 2020-02-01 21:03:20 UTC


README

A PHP SDK for the Shopware 5 REST API.

!!!! This project is out of date and no longer beeing maintained. There are forks available; e.g. portrino/shopware-sdk or neta-io/shopware-sdk !!!!

STATUS: Looking for a new maintainer!

Code information:

Build Status Coverage Status Code Coverage Scrutinizer Code Climate Scrutinizer Code Quality StyleCI

Package information:

Latest Stable Version Total Downloads Latest Unstable Version License Dependency Status

Installing

composer require leadcommerce/shopware-sdk

Code Docs

See API Docs

Examples

<?php
    require 'vendor/autoload.php';
    
    // Create a new client
    $client = new ShopwareClient('http://shopware.dev/api/', 'user', 'api_key');

    /**
     * set custom options for guzzle
     * the official guzzle documentation contains a list of valid options (http://docs.guzzlephp.org/en/latest/request-options.html) 
     */  
    //$client = new ShopwareClient('http://shopware.dev/api/', 'user', 'api_key', ['cert' => ['/path/server.pem']]);
    
    // 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]);
?>

Issues/Features proposals

Here is the issue tracker.

Contributing :-)

License

MIT

Authors