leadcommerce / shopware-sdk

该包已被 弃用 并不再维护。未建议替代包。

Shopware 5 REST API 的 PHP SDK。

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

Shopware 5 REST API 的 PHP SDK。

!!!! 该项目已过时且不再维护。有可用的分支,例如 portrino/shopware-sdkneta-io/shopware-sdk !!!!

状态: 寻找新的维护者!

代码信息

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

包信息

Latest Stable Version Total Downloads Latest Unstable Version License Dependency Status

安装

composer require leadcommerce/shopware-sdk

代码文档

请参阅 API 文档

示例

<?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]);
?>

问题/特性建议

这里 是问题跟踪器。

贡献 :-)

许可证

MIT

作者