PHP code example of acendy / acendy-api-client

1. Go to this page and download the library: Download acendy/acendy-api-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/ */

    

acendy / acendy-api-client example snippets




use Acendy\Api\Client\AcendyApiClient;

use GuzzleHttp\Client;
use GuzzleHttp\Psr7\HttpFactory;

$client = new AcendyApiClient(
    baseURL: 'https://api.mystore.no/',
    token: 'your-api-token',
    storeName: 'your-store-name',
    httpClient: new Client(),
    requestFactory: new HttpFactory(),
    streamFactory: new HttpFactory()
);

$customers = $client->customers()->getAllCustomers();
print_r($customers);

$customer = $client->customers()->getCustomerById('123456');
print_r($customer);

use Acendy\Api\Client\QueryParameters;

$queryParams = new QueryParameters(
    pageNumber: 1,
    pageSize: 5
);
$paginatedOrders = $client->orders()->getAllOrders($queryParams);
print_r($paginatedOrders);

use Acendy\Api\Client\QueryParameters;

$queryParams = new QueryParameters(
    pageNumber: 1,
    pageSize: 50,
    filters: [
        'customer.id' => '123456',
        'order-status.id' => '1',
        'currency' => 'NOK'
    ],
    sort: ['-created_at'],