This HEPTAconnect package is all about communicating to Shopware 6 APIs. You can use it in combination with the Shopware 6 Portal. Read more in the documentation (especially the package design decision) and have a look into the examples section.
composer require heptacom/heptaconnect-package-shopware-6
- Use guide for specific situation:
- Follow examples below
<?php
use Heptacom\HeptaConnect\Package\Shopware6\EntitySearch\Contract\Aggregation\TermsAggregation;
use Heptacom\HeptaConnect\Package\Shopware6\EntitySearch\Contract\Filter\EqualsFilter;
use Heptacom\HeptaConnect\Package\Shopware6\Http\AdminApi\Utility\EntityClient;
/** @var $entityClient EntityClient */
$propertyGroupId = $entityClient->create('property_group', [
'name' => 'Color',
'sortingType' => 'position',
'displayType' => 'color',
'options' => [[
'position' => 1,
'name' => 'Red',
'colorHexCode' => '#aa0000',
], [
'position' => 2,
'name' => 'Green',
'colorHexCode' => '#00aa00',
], [
'position' => 3,
'name' => 'Blue',
'colorHexCode' => '#0000aa',
]],
]);
$colorNamesByName = $entityClient->groupFieldByField(
'property_group_option',
'colorHexCode',
'name',
new EqualsFilter('group.id', $propertyGroupId)
);
var_export($colorNamesByName);
// array (
// '#0000aa' => 'Blue',
// '#00aa00' => 'Green',
// '#aa0000' => 'Red',
// )
// paginates automatically
foreach ($entityClient->iterate('product') as $product) {
// …
}
$countryIsos = $entityClient->aggregate('country', new TermsAggregation('countries', 'iso'))->buckets->getKeys();
var_export($countryIsos->asArray());
// array (
// 0 => 'AD',
// 1 => 'AE',
// 2 => 'AF',
// 3 => 'AG',
// 4 => 'AI',
// …
<?php
use Heptacom\HeptaConnect\Package\Shopware6\Http\AdminApi\Utility\ExtensionClient;
/** @var $extensionClient ExtensionClient */
// remote updating security plugin
$extensionClient->upload('/path/to/SwagSecurityPlatform.zip');
$extensionClient->refresh();
$extensionClient->update('SwagSecurityPlatform');
if (!$extensionClient->isInstalled('SwagSecurityPlatform')) {
$extensionClient->install('SwagSecurityPlatform');
}
if (!$extensionClient->isActive('SwagSecurityPlatform')) {
$extensionClient->activate('SwagSecurityPlatform');
}
<?php
use Heptacom\HeptaConnect\Package\Shopware6\Http\AdminApi\Utility\GenericClient;
/** @var $client GenericClient */
// low amount of parameters
var_export($client->get('_info/version'));
// array (
// 'version' => '6.4.20.0',
// )
// query parameters
var_export($client->get('_action/system-config', [
'domain' => 'core.update',
]));
// array (
// 'core.update.apiUri' => 'https://update-api.shopware.com',
// 'core.update.channel' => 'stable',
// 'core.update.code' => '',
// )
// JSON body
$client->post('_action/system-config', [
'key' => 'value',
]);
// header support
$client->post('_action/order/00000000000000000000000000000000/state/complete', [], [], [
// do not run flows to silently update order state
'sw-skip-trigger-flow' => 1,
]);
<?php
use Heptacom\HeptaConnect\Package\Shopware6\Http\StoreApi\Utility\GenericClient;
/** @var $client GenericClient */
// low amount of parameters
var_export($client->get('context')['token']);
// 12c9a85D538b4795877A95aC908987db
// different methods
var_export(\array_column($client->post('country')['data'], 'iso'));
// array (
// 0 => 'AD',
// 1 => 'AE',
// 2 => 'AF',
// 3 => 'AG',
// 4 => 'AI',
// …
- PHP 8.0 or above
See the attached CHANGELOG.md file for a complete version history and release notes.
See the Architecture Decision Records to understand decisions made, that influence the structure of this project.
- Make
- Any debugging/coverage php extension like xdebug or pcov
- A running Shopware 6 instance
Thank you for considering contributing to this package! Be sure to sign the CLA after creating the pull request.
- Fork the repository
git clone yourname/heptaconnect-package-shopware-6
- Make your changes to master branch
- Create your Pull-Request
- Compare your code against the project ADRs
- Check and fix code style
make cs-fix && make cs
- Setup Shopware 6 instance for testing. Checkout dockware.io for a Shopware 6 development instance
- Set
TEST_ADMIN_API_URL
,TEST_ADMIN_API_USERNAME
,TEST_ADMIN_API_PASSWORD
to point to your Shopware 6 instance - Optionally set
TEST_STORE_API_URL
,TEST_STORE_API_ACCESS_KEY
to point to your Shopware 6 instance. If not set the Admin API credentials will be used to create the data
- Set
- Check tests
make -e test
- Check whether test code coverage is same or higher
make -e coverage
- Check whether tests can find future obscurities
make -e infection
Copyright 2020 HEPTACOM GmbH
Dual licensed under the GNU Affero General Public License v3.0 (the "License") and proprietary license; you may not use this project except in compliance with the License. You may obtain a copy of the AGPL License at https://spdx.org/licenses/AGPL-3.0-or-later.html. Contact us on our website for further information about proprietary usage.