PHPackages                             it-bens/shopware-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. it-bens/shopware-sdk

ActiveLibrary[API Development](/categories/api)

it-bens/shopware-sdk
====================

A PHP SDK for Shopware 6 Platform (forked from vin-sw/shopware-sdk)

v0.6.0(1y ago)23.1k[1 issues](https://github.com/it-bens/shopware-php-sdk/issues)[6 PRs](https://github.com/it-bens/shopware-php-sdk/pulls)1MITPHPPHP ^8.3 || ^8.4CI passing

Since Oct 12Pushed 1w agoCompare

[ Source](https://github.com/it-bens/shopware-php-sdk)[ Packagist](https://packagist.org/packages/it-bens/shopware-sdk)[ RSS](/packages/it-bens-shopware-sdk/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (7)Dependencies (20)Versions (14)Used By (1)

Shopware 6 PHP SDK
==================

[](#shopware-6-php-sdk)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

Note

This package is a fork of the vienthuong Shopware SDK () but large parts of the code have been rewritten and new concepts were introduced.

A Symfony bundle for this package is also available at [Shopware SDK Bundle](https://github.com/it-bens/shopware-php-sdk-bundle).

Shopware PHP SDK is a SDK implementation of the Shopware 6 API. It helps to access the API in an object-oriented way.

Installation
------------

[](#installation)

The SDK can be installed via composer

```
composer require it-bens/shopware-sdk
```

Main Features
-------------

[](#main-features)

- Admin API
    - CRUD API
    - [Admin Search API](https://github.com/shopware/administration/blob/trunk/Controller/AdminSearchController.php) (read-equivalent to the Sync API)
    - [Document API](https://github.com/shopware/core/blob/trunk/Checkout/Document/Controller/DocumentController.php) + [Document Generator API](https://github.com/shopware/core/blob/trunk/Checkout/Document/DocumentGeneratorController.php)
    - [Info API](https://github.com/shopware/core/blob/trunk/Framework/Api/Controller/InfoController.php)
    - [Mail Send API](https://github.com/shopware/core/blob/trunk/Content/MailTemplate/Api/MailActionController.php)
    - [Media API](https://github.com/shopware/core/blob/trunk/Content/Media/Api/MediaUploadController.php)
    - [Notification API](https://github.com/shopware/administration/blob/trunk/Controller/NotificationController.php)
    - [Number Range API](https://github.com/shopware/core/blob/trunk/System/NumberRange/Api/NumberRangeController.php)
    - [State Machine API](https://github.com/shopware/core/blob/trunk/System/StateMachine/Api/StateMachineActionController.php)
    - [Sync API](https://github.com/shopware/core/blob/trunk/Framework/Api/Controller/SyncController.php) (upserting/deleting multiple entities in a single request)
    - [System Config API](https://github.com/shopware/core/blob/trunk/System/SystemConfig/Api/SystemConfigController.php)
    - [User Config API](https://github.com/shopware/administration/blob/trunk/Controller/UserConfigController.php)
    - [User API](https://github.com/shopware/core/blob/trunk/Framework/Api/Controller/UserController.php)

Tip

A Symfony bundle for this package is also available at [Shopware SDK Bundle](https://github.com/it-bens/shopware-php-sdk-bundle).

Tip

A Laravel 8 package for the forked package is also available at [Laravel Shopware SDK Adapter](https://github.com/Shape-and-Shift/shopware-laravel-sdk).

Usage
-----

[](#usage)

### Authentication and Context

[](#authentication-and-context)

#### Authentication

[](#authentication)

All requests to the API (except for the OAuth token request) require a `Context` object. The high-level services like the repositories and the API services are building the context by themself via dependency injection. They require a `ContextBuilderFactoryInterface` implementation. This factory requires an `AccessTokenProvider` implementation.

There currently two implementations available:

- `WithClientCredentials` for an authentication with client ID and client secret
- `WithUsernameAndPassword` for an authentication with username and password

If the application is done with username and password, Shopware will also return a refresh token. While the grant type is implemented, It is currently not used in the SDK.

The dependency injection chain for the `ContextBuilderFactory` looks like this:

`AccessTokenFetcher` --&gt; `AccessTokenProvider` --&gt; `ContextBuilderFactory`

The `AccessTokenFetcher` should be cached with a PSR-16 cache implementation with the `CachedFetcher`. The `SimpleFetcher` can be used directly but this would lead to a new token request for every request.

Warning

Requesting a new access token for every request will probably lead to a rate limit hit on the Shopware API.

#### Context

[](#context)

The `Context` also contains the Shopware URL and several parameters that will be sent to Shopware as headers:

- Language ID
- Currency ID
- Version ID (for creating multiple versions of an entity)
- Compatibility
- inheritance (whether the entity should inherit from the parent entity)

More headers can be added as well.

The `ContextBuilder` takes care of the `Context` creation via builder pattern.

```
use Vin\ShopwareSdk\Context\ContextBuilder;
use Vin\ShopwareSdk\Auth\AccessTokenProvider;

$shopwareUrl = 'https://shopware.local';
/** @var AccessTokenProvider $accessTokenProvider */
$contextBuilder = new ContextBuilder($shopwareUrl, $accessTokenProvider);

$contextBuilder->withLanguageId('188208f3609a43d1a493698363fa3cce')
    ->withAdditionalHeader('indexing-behavior', 'disable-indexing');
$context = $contextBuilder->build();
```

### Entity Definitions

[](#entity-definitions)

The package contains complete sets of Shopwares native entities and their definitions for different Shopware versions. Every entity has a definition class, an entity class and a collection class. They can be found in the `Vin\ShopwareSdk\Data\Entity` namespace grouped by the Shopware version.

The `DefinitionProvider` collects these definitions via `DefinitionCollectionPopulator` implementations. This package already provides the `WithSdkMapping` implementation. It registers the native entities by using a JSON mapping file. Users of this package can add other implementations to add or overwrite definitions. This is useful if entities of Shopware plugins should be used. Overwriting the native definition and entity is necessary if the Shopware plugin adds an extension/relation.

The `SchemaProvider` requires a `DefinitionProviderInterface` implementation. It is a convenience class to prevent the construction of the `Schema` objects on every `getSchema` call. The repeated construction lead to a huge performance decrease in the hydration process of the original repository.

### Entity hydration

[](#entity-hydration)

The hydration is an internal process and will not be discussed too deeply here. The process was nearaly completely rewritten in comparison to the original package. This lead to a huge performance increase for entities with many relations. (I tested it in production with an entity that had about 1000 related entities: hydration took more than 15 minutes with the old process and about 20 seconds with the new one)

The process supports all kinds of searches, relations and extensions. Aggregations are not supported yet.

The hydrated entities contain scalar values, typed relations to other entities, collections for to-many relations and extensions (these are provided by the `Struct` class).

### Entity Repository

[](#entity-repository)

An `EntityRepository` requires an `EntityDefinition` a `ContextBuilderFactoryInterface` implementation, an `HttpClientInterace` implementation and a `HydratorInterface` implementation.

The re-addition of a repository factory is planned but not yet implemented.

To simplify the creation and usage of repositories, this package provides a `RepositoryProvider` that requires a `DefinitionProviderInterface` and the dependencies mentioned above. The provider caches the created repositories. A repository can be requested with the `getRepository` method by its entity name. The entity name can be taken from the entity definition via `getEntityName` method.

#### Criteria

[](#criteria)

The criteria usage is similar the usage in the Shopware core DAL: [Search Criteria Documentation](https://developer.shopware.com/docs/guides/integrations-api/general-concepts/search-criteria.html).

This is an example to retrieve a product that have free shipping:

```
use Vin\ShopwareSdk\Repository\RepositoryProviderInterface;
use Vin\ShopwareSdk\Data\Entity\v0000\Product\ProductDefinition;
use Vin\ShopwareSdk\Data\Criteria;
use Vin\ShopwareSdk\Data\Filter\EqualsFilter;

/** @var RepositoryProviderInterface $repositoryProvider */
$productRepository = $repositoryProvider->getRepository(ProductDefinition::class);

$criteria = new Criteria();
$criteria->addFilter(new EqualsFilter('shippingFree', true));

$products = $productRepository->search($criteria); // the formerly required context object is created by the repository itself
```

### API Services

[](#api-services)

The supported APIs were already mentioned in the [Main Features](#main-features) section. Most service calls allow the usage of additional HTTP headers.

PSR Usage
---------

[](#psr-usage)

In order to make this package more compatible with existing code bases, it uses several PSR interfaces instead of concrete implementations.

### PSR-7, PSR-17 and PSR-18

[](#psr-7-psr-17-and-psr-18)

While the original package uses GuzzleHttp, this package works with any implementation of the mentioned interfaces. GuzzleHttp is one of them. But Nyholm and Symfony HTTP clients are working as well.

### PSR-16

[](#psr-16)

The `CachedFetcher` requires a PSR-16 cache implementation. This simple cache is provided by the Symfony cache component. But it can be implemented very easy by yourself, too.

### PSR-20

[](#psr-20)

The clock is used for the token expiration check instead of the native `time` function. This is especially useful for testing.

Contributing
------------

[](#contributing)

I am really happy that the software developer community loves Open Source, like I do! ♥

That's why I appreciate every issue that is opened (preferably constructive) and every pull request that provides other or even better code to this package.

You are all breathtaking!

Special Thanks
--------------

[](#special-thanks)

Special thanks goes to the original author of the package, [vienthuong](https://github.com/vienthuong) and the other contributors of the original package.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance62

Regular maintenance activity

Popularity24

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~16 days

Recently: every ~24 days

Total

7

Last Release

530d ago

PHP version history (2 changes)v0.1.0PHP ^8.1 || ^8.2 || ^8.3

v0.6.0PHP ^8.3 || ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/94aa1cc7aa38ca9d3f6bb96541ff813027df1f0cf478b3c53c41385876503b2c?d=identicon)[SpiGAndromeda](/maintainers/SpiGAndromeda)

---

Top Contributors

[![SpiGAndromeda](https://avatars.githubusercontent.com/u/15141351?v=4)](https://github.com/SpiGAndromeda "SpiGAndromeda (145 commits)")[![vienthuong](https://avatars.githubusercontent.com/u/22548423?v=4)](https://github.com/vienthuong "vienthuong (60 commits)")[![silverDuy](https://avatars.githubusercontent.com/u/22496269?v=4)](https://github.com/silverDuy "silverDuy (4 commits)")[![raphael-homann](https://avatars.githubusercontent.com/u/7700663?v=4)](https://github.com/raphael-homann "raphael-homann (3 commits)")[![C0DE8](https://avatars.githubusercontent.com/u/20956699?v=4)](https://github.com/C0DE8 "C0DE8 (2 commits)")[![dag-inbase](https://avatars.githubusercontent.com/u/103109181?v=4)](https://github.com/dag-inbase "dag-inbase (2 commits)")[![radsto](https://avatars.githubusercontent.com/u/94012491?v=4)](https://github.com/radsto "radsto (2 commits)")[![zrja](https://avatars.githubusercontent.com/u/58917672?v=4)](https://github.com/zrja "zrja (1 commits)")[![iNem0o](https://avatars.githubusercontent.com/u/1144755?v=4)](https://github.com/iNem0o "iNem0o (1 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (1 commits)")[![gabriel-efrogg](https://avatars.githubusercontent.com/u/175226866?v=4)](https://github.com/gabriel-efrogg "gabriel-efrogg (1 commits)")[![solverat](https://avatars.githubusercontent.com/u/700119?v=4)](https://github.com/solverat "solverat (1 commits)")[![fkwakkenbos](https://avatars.githubusercontent.com/u/1029218?v=4)](https://github.com/fkwakkenbos "fkwakkenbos (1 commits)")[![vekkon](https://avatars.githubusercontent.com/u/26244609?v=4)](https://github.com/vekkon "vekkon (1 commits)")[![canvural](https://avatars.githubusercontent.com/u/1574232?v=4)](https://github.com/canvural "canvural (1 commits)")[![malganis93](https://avatars.githubusercontent.com/u/1519805?v=4)](https://github.com/malganis93 "malganis93 (1 commits)")

---

Tags

shopware

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/it-bens-shopware-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/it-bens-shopware-sdk/health.svg)](https://phpackages.com/packages/it-bens-shopware-sdk)
```

###  Alternatives

[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60216.0M85](/packages/mollie-mollie-api-php)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
