PHP code example of retailcrm / geohelper-php-sdk

1. Go to this page and download the library: Download retailcrm/geohelper-php-sdk 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/ */

    

retailcrm / geohelper-php-sdk example snippets





$clientInterface = new \GuzzleHttp\Client();

$client = new RetailCrm\Geohelper\ApiClient(
    $clientInterface,
    'api_key'
);

$response = $client->countriesList();

if ($response->isSuccessful()) {
    $countries = isset($response['result']) ? $response['result'] : array();
    foreach ($countries as $country) {
        echo $country['name'];
    }
} else {
    echo sprintf(
        "Error: [HTTP-code %s] %s",
        $response->getStatusCode(),
        $response->getErrorMsg()
    );
}
bash
composer