PHP code example of 3mg / russian-post-bundle

1. Go to this page and download the library: Download 3mg/russian-post-bundle 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/ */

    

3mg / russian-post-bundle example snippets


$api = $this->container->get('russian_post_api');

try {
    /** @var \a3mg\RussianPostBundle\Model\OperationHistoryData $object */
    $object = $api->getTrackOperationHistory("EE123456785KR");
    ...
} catch (\a3mg\RussianPostBundle\Exception\InvalidTrackException $e) {
    ...
} catch (\a3mg\RussianPostBundle\Exception\RussianPostApiException $e) {
    ...
}

use a3mg\RussianPostBundle\Service\RussianPostApiFactory;
...
$api = RussianPostApiFactory::createApi("your_login", "your_password");
try {
    /** @var \a3mg\RussianPostBundle\Model\OperationHistoryData $object */
    $object = $api->getTrackOperationHistory("EE123456785KR");
    ...
} catch (\a3mg\RussianPostBundle\Exception\InvalidTrackException $e) {
    ...
} catch (\a3mg\RussianPostBundle\Exception\RussianPostApiException $e) {
    ...
}