PHP code example of develart-projects / olza-logisctic-api-client

1. Go to this page and download the library: Download develart-projects/olza-logisctic-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/ */

    

develart-projects / olza-logisctic-api-client example snippets


// Setup autoloading
lient as ApiClient;
use OlzaApiClient\Services\Transport;

use OlzaApiClient\Entities\Helpers\HeaderEntity;
use OlzaApiClient\Entities\Helpers\GetStatusesEntity;

use OlzaApiClient\Entities\Request\ApiBatchRequest;

// YOUR SPECIFIC DATA
$apiUser = 'XXX';
$apiPassword = 'XXX';
$apiUrl = 'http://XXX';
// SPECIFIC DATA END

// build header using t->setHeaderFromHelper($header)
           ->setPayloadFromHelper($shipments);

// prepare Transport object
$transportService = new Transport($apiUrl); // <-- will use Guzzle, if installed

// communicate with Olza API using client
$apiClient = new ApiClient($transportService);
$apiResponse = $apiClient->getStatuses($apiRequest);

echo '<pre>';
print_r($apiResponse);
echo '</pre>';

// Setup autoloading
lient as ApiClient;
use OlzaApiClient\Services\Transport;

// your custom PSR-17 packages
use HttpSoft\Message\RequestFactory;
use HttpSoft\Message\ResponseFactory;
use HttpSoft\Message\StreamFactory;

// prepare HTTP client
$httpClient = new \Symfony\Component\HttpClient\Psr18Client(null, new ResponseFactory, new StreamFactory);

// prepare transport object with your custom packages
$transportService = new Transport($apiUrl, $httpClient, new RequestFactory, new StreamFactory);

// now you can use the client
$apiClient = new ApiClient($transportService);


bash
# Install Composer
curl -sS https://getcomposer.org/installer | php