2017 © Pedro Peláez
 

library shopware-sdk

An implementation for accessing the Shopware api

image

enm/shopware-sdk

An implementation for accessing the Shopware api

  • Thursday, June 15, 2017
  • by eosnewmedia
  • Repository
  • 8 Watchers
  • 4 Stars
  • 625 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 9 Versions
  • 1 % Grown

The README.md

Shopware SDK

Build Status SensioLabsInsight, (*1)

This library provides an extendable abstraction for the Shopware REST-API. The provided default implementation is based on jms/serializer and guzzlehttp/guzzle. All provided interfaces can be used without installing Guzzle or the Serializer., (*2)

Installation

composer require enm/shopware-sdk

If you want to use the default implementation you also have to run:, (*3)

composer require guzzlehttp/guzzle

composer require jms/serializer

Usage

\Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace(
    'JMS\Serializer\Annotation', __DIR__.'/../vendor/jms/serializer/src'
);

$client = new \Enm\ShopwareSdk\Http\GuzzleAdapter(new \GuzzleHttp\Client());
$client->withConfig('http://example.com', 'user', 'apiKey');

$serializer = \JMS\Serializer\SerializerBuilder::create()->build();


$entryPoint = new \Enm\ShopwareSdk\EntryPoint($client);

$entryPoint->addSerializer(new \Enm\ShopwareSdk\Response\ArticleHandler($serializer));
$entryPoint->addSerializer(new \Enm\ShopwareSdk\Response\OrderHandler($serializer));

$entryPoint->addDeserializer(new \Enm\ShopwareSdk\Response\ArticleHandler($serializer));
$entryPoint->addDeserializer(new \Enm\ShopwareSdk\Response\OrderHandler($serializer));

OR, (*4)

$entryPoint = \Enm\ShopwareSdk\EntryPoint::buildDefault('http://example.com', 'user', 'apiKey');

The endpoints can be called like this:, (*5)

$entryPoint->articles()->findAll();
$entryPoint->articles()->find(1);

$entryPoint->orders()->findAll();
$entryPoint->orders()->find(1);

Concepts

Entry Point

An entry point should implement \Enm\ShopwareSdk\EntryPointInterface and is responsible for creation and management of endpoint instances., (*6)

The default entry point (\Enm\ShopwareSdk\EntryPoint) needs a configured http client and a serializer and deserializer for each endpoint., (*7)

A serializer can be added by calling:, (*8)

    $entryPoint->addSerializer($serializer);

A deserializer can be added by calling:, (*9)

    $entryPoint->addDeserializer($serializer);

Endpoints

An endpoint is responsible for providing access to a specific sub part of the shopware api., (*10)

The ArticelEndpoint for example is responsible to access all api routes under /api/articles., (*11)

All default endpoints extending the abstract endpoint which needs a http client and a response handler., (*12)

(HTTP-)Client

The http client is responsible to request an api route and create a PSR-7 response object with the result., (*13)

The default client (\Enm\ShopwareSdk\Http\GuzzleAdapter) uses the Guzzle http client., (*14)

Serializer / Deserializer

A serializer is responsible for converting a given PHP object into the needed json string., (*15)

A deserializer is responsible for converting the json response into the needed PHP object., (*16)

The default handlers (combination of serializer and deserializer) are based on JMS Serializer and can be added by calling addDefaultSerializers and addDefaultDeserializers from the default EntryPoint., (*17)

If you don't want to use it, you can write your own which have to implement \Enm\ShopwareSdk\Serializer\JsonSerializerinterface and/or \Enm\ShopwareSdk\Serializer\JsonDeserializerinterface., (*18)

A (de)serializer must return all supported types if getSupportedTypes is called. A type is the class name of the models interface, for example: \Enm\ShopwareSdk\Model\Order\OrderInterface for the OrderEnpoint., (*19)

The Versions

15/06 2017

dev-master

9999999-dev

An implementation for accessing the Shopware api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien
by Dirk Heyka
by Nicklas Reincke

15/06 2017

dev-develop

dev-develop

An implementation for accessing the Shopware api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien
by Dirk Heyka
by Nicklas Reincke

15/06 2017

0.1.4

0.1.4.0

An implementation for accessing the Shopware api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien

15/06 2017

dev-hotfix/0.1.4

dev-hotfix/0.1.4

An implementation for accessing the Shopware api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien

15/06 2017

0.1.3

0.1.3.0

An implementation for accessing the Shopware api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien

19/04 2017

0.1.2

0.1.2.0

An implementation for accessing the Shopware api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien
by Dirk Heyka
by Nicklas Reincke

05/04 2017

0.1.1

0.1.1.0

An implementation for accessing the Shopware api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien
by Dirk Heyka
by Nicklas Reincke

21/03 2017

0.1.0

0.1.0.0

An implementation for accessing the Shopware api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien
by Dirk Heyka
by Nicklas Reincke

07/03 2017

dev-release/0.1.0

dev-release/0.1.0

An implementation for accessing the Shopware api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien
by Dirk Heyka
by Nicklas Reincke