PHP code example of axro / shopware-oauth2-client

1. Go to this page and download the library: Download axro/shopware-oauth2-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

axro / shopware-oauth2-client example snippets


use AxroShopware\Client\ShopwareClient;

// Create an instance with your credentials
$client = new ShopwareClient(
    $baseUrl, $clientId, $clientSecret
);

// add your monolog logger LoggerInterface
$client->setLogger($logger);

// send a request with the payload requested by the api.
foreach(something...) {
    // create $payload with your data from foreach etc.
    $client->requestAsync('PATCH', '/api/_action/example_extension/update', $payload);
}
$responses = $client->promise();

// to return objects in numeric array instead of an array, set argument to true
$responses = $client->promise(true);