Download the PHP package it-bens/shopware-sdk-bundle without Composer

On this page you can find all versions of the php package it-bens/shopware-sdk-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package shopware-sdk-bundle

Shopware 6 SDK Bundle for Symfony

Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge Packagist Version codecov

This bundle wraps the Shopware 6 SDK into a Symfony bundle.

The bundle is tested with PHP Symfony 6.4 (PHP 8.3, PHP 8.4) and with Symfony 7.1 (PHP 8.3, PHP 8.4).

Installation

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

Applications that don't use Symfony Flex

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

Requirements

The PSR implementations can be chosen freely.

Configuration

Add the following configuration to your config/packages/itb_shopware_sdk.yaml:

The shopware_version key determines what entity schema is used for the native Shopware entities. Available versions are: 0.0.0.0, 6.5.5.0, 6.5.6.0, 6.5.7.1, 6.5.8.0, 6.5.8.3, 6.5.8.8, 6.5.8.12, 6.6.0.0, 6.6.3.0, 6.6.4.0, 6.6.5.0, 6.6.6.0 and 6.6.7.0. Use the next lower version in comparison to your Shopware version. The listed versions were the lowest that introduced entity schema changes. 0.0.0.0 can be used to use the entity schemas and definitions from the original SDK package.

There are two grant types available: client_credentials and password. A authentication with the password grant type requires this configuration:

The credentials block will not be merged with other configuration files or environments to prevent Environment variables ... are never used. errors when different grant types are used in different environments. The block will be overwritten according to the hirarchy defined by Symfony: https://symfony.com/doc/current/configuration.html#configuration-environments.

Cache

The cache key in the configuration determines if the obtained OAuth token should be cached. If set to null every request will request a new token from Shopware, before doing anything else.

In a typical Symfony project, there are already several cache pools available. However, these implement Symfonys own cache contracts/interfaces. This Shopware SDK requires a PSR-16 implementation to make it compatible with other frameworks and framework-less applications.

A PSR-16 implementation can be easily defined as a service if the symfony/cache component is installed:

Usage

CRUD Repository

Shopware provides the usual CRUD operations for entities. The bundle provides repositories to execute this operations.

The repositories can injected directly via autowiring:

The dependency injection container will automatically will let the RepositoryProvider create the requested repositories based on the argument name. The argument name has to be the entity name in camel case with the suffix EntityRepository. The RepositoryInterface type hint is required.

Alternatively, they can be obtained via the RepositoryProviderInterface.

The provider caches the repositories, so they don't have to be recreated every time, the method is called.

[!IMPORTANT]
The chosen Shopware version determines which entity classes are hydrated and returned by the repository. Pay attention to the usage of the correct entity classes in your project.

API Service

Besides from the CRUD entity endpoints, Shopware provides endpoints that are either not entity related or perform special operations outside the CRUD scope. The currently available API services are:

They can be obtained directly via their interfaces:

Adding and Overriding Entity Definitions

The SDK package provides definitions, entity classes and collection classes for the native Shopware entities. New entities can be added to Shopware via Plugins. The SDK package and this bundle provide a way to add these entities to your project.

This requires an implementation of the DefinitionCollectionPopulator interface.

If the service has the AsEntityDefinitionCollectionPopulator attribute and is marked for autoconfiguration (this will likely happen in a typical Symfony project), the service is automatically tagged as a DefinitionCollectionPopulator.

After that a compiler pass in this bundle will detect the tag and add the service to the DefinitionCollectionProvider. Of cause the service can be tagged manually as well:

The priority determines the order in which the populators are used. The native populator has the priority 1000 and is used first. This allows to override existing definitions by populators with a lower priority. The entity name is used as a key in the definition collection and allows to overwrite native/existing definitions by usage of the same entity name.

[!TIP] If a Shopware plugin adds relations to existing entities, these relations have to be present in the entity definition in this bundle as well. Overwriting the native definition with a populator is the way to go.

The native definition class can be copied and modified. The entity class does not have to be modified because Shopware returns tha added relations as an extension and extensions are already part of all entity classes.

Custom Usages

This bundle provides the following additional services via dependency injection:

The purpose and usage of this services is explained in the SDK repository.

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!


All versions of shopware-sdk-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3 || ^8.4
it-bens/shopware-sdk Version ^0.6
symfony/config Version ^6.4|^7.1
symfony/dependency-injection Version ^6.4|^7.1
symfony/http-kernel Version ^6.4|^7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package it-bens/shopware-sdk-bundle contains the following files

Loading the files please wait ....